471,079 Members | 961 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,079 software developers and data experts.

Stored procedure returning wrong value because of ANSI_WARNINGS

I have been researching this problem for a week now and I haven't found anything that works. Here is the problem: We recently removed the SET ANSI_WARNINGS OFF code at the top of all of our triggers because they were causing way too many recompiles and we were seeing locking, blocking and timeouts. Unfortunately, we are now seeing many application errors (VB6) where the warnings are causing errors in our recordsets and return values. The default on the SQL Server database is set to OFF. I have now added "ansinpw=off;" to the connection string. I have even added the following:

Expand|Select|Wrap|Line Numbers
  1. Dim connCurrent As New ADODB.Connection
  2. connCurrent.Execute "SET ANSI_WARNINGS  OFF"
  3.  
My question to all of you is where else might these be being set to on? It really isn't an option to include them in the offending triggers because of the locking issues?

Thanks very much for any insight you can give me.

Laurie
Feb 8 '07 #1
5 2704
iburyak
1,017 Expert 512MB
I think it should be in the same execute statement. It is only a guess.
Try this:

[PHP]Dim connCurrent As New ADODB.Connection
connCurrent.Execute "SET ANSI_WARNINGS OFF" & vbcrlf & "go" & vbcrlf & "execute your code here"[/PHP]

But you can go to the server and execute following line

[PHP]DBCC USEROPTIONS[/PHP]

If you see this record
[PHP]
ansi_warnings SET[/PHP]

It means that Server's ANSI_WARNINGS is on.


To changes global configuration settings for the current server use
sp_configure ......

I would recommend your DBA do it.
Feb 8 '07 #2
iburyak
1,017 Expert 512MB
Also check your stored proc code to eliminate nulls in counts and group by.
Feb 8 '07 #3
Also check your stored proc code to eliminate nulls in counts and group by.
I'm beginning to think this is the only viable solution. Unfortunately, this will require more testing by QA and I was looking for a simpler solution. I know for a fact that the database default is to OFF because I ran the sql to verify the setting. It's included in the connection string, so where do you think this might be getting set to ON?
Feb 8 '07 #4
iburyak
1,017 Expert 512MB
Did you try this?

[PHP]
Dim connCurrent As New ADODB.Connection
connCurrent.Execute "SET ANSI_WARNINGS OFF" & vbcrlf & "go" & vbcrlf & "execute your proc here" [/PHP]
Feb 8 '07 #5
iburyak
1,017 Expert 512MB
You know, from my experience it could be if database was restored from another server where it was on at the time trigger\stored proc was created.

Did you try to drop \ recreate it again?

I am not authoritative source on it thou. I am a programmer like you not a DBA.
Feb 8 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by sbest | last post: by
6 posts views Thread by David Lozzi | last post: by
1 post views Thread by MDB | last post: by
4 posts views Thread by scparker | last post: by
9 posts views Thread by fniles | last post: by
7 posts views Thread by eholz1 | last post: by
2 posts views Thread by bbawa1 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.