Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jawatts
Starting Member
3 Posts |
Posted - 2002-03-11 : 14:37:25
|
| Help! We have just successfully (we thought) upgraded our 6.5 database to 2000. Unfortunately, one of our queries is not responding the same way.Here is the original query:Update table setfield = 'abcdefg'field is char(7)In sql 6.5, 'abcdef' gets inserted into the field which is a problem in itself, but the query does not fail.In 2000, the same query gives the following error:Server: Msg 8152, Level 16, State 9, Line 1String or Binary data would be truncated. The statement has been terminated.My question is, how do I configure 2000 to mimic the truncating 'feature' that 6.5 seems to have.Notes: 1 - All the queries are hard coded in VB an cannot be changed at this time so I do not have the option of making any changes there.2 - In the near future, I can just increase the size of the field, but that is not an immediate solution on a production server.Thanks in advance for any advice!Jason |
|
|
jawatts
Starting Member
3 Posts |
Posted - 2002-03-11 : 14:42:37
|
| BTW, In query profiler, I know you can SET ANSI_WARNINGS OFF. I would have to set this every time before running the query (which I can't do because of the hard coded query).Can this be a default SQL server setting?Jason |
 |
|
|
chadmat
The Chadinator
1974 Posts |
Posted - 2002-03-11 : 15:23:27
|
| If you right click on your server in EM, go to properties, and select the connections tab. You can set Ansi Warnings as a server level setting, but I'm not sure if that will solve the issue.BTW. That query should work, the insert is only 7 characters.If 8 characters are inserted you should get the error you mention.This is very bad coding practice, and I would suggest fixing that rather than expecting SQL Server to "Deal" with the real problem.-Chad |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-03-11 : 15:32:41
|
| i would change the column def to, say, varchar(255), if your code doesn't respect the fixed-width size of the column anyway. |
 |
|
|
|
|
|
|
|