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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL-92 Settings Statements in Stored Procs

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-11-01 : 08:15:23
Marc writes "Hi all,

I am looking for some information on where to set the SQL-92 Settings Statements and why. I have seen the statements, such as "SET ANSI_DEFAULTS ON" or "SET ANSI_NULLS ON", set before the drop of a procedure, before the create procedure command and inside the proc itself. It seems the proc behaves differently depending on where these settings are made. I have not been able to find the final word from Microsoft on this. I know a number of these settings cause the proc to recompile but does it matter if it is outside or inside the proc?

If the settings are before the create procedure command then how does the proc know to follow these settings when the proc is called from an app?

Thanks

Marc"

surefooted
Posting Yak Master

188 Posts

Posted - 2004-11-01 : 10:57:16
From Books OnLine:

"For stored procedures, SQL Server uses the SET ANSI_NULLS setting value from the initial creation time of the stored procedure. Whenever the stored procedure is subsequently executed, the setting of SET ANSI_NULLS is restored to its originally used value and takes effect. When invoked inside a stored procedure, the setting of SET ANSI_NULLS is not changed."

Check out BOL for more info on the set commands.

-Jon
Should still be a "Starting Member" .
Go to Top of Page
   

- Advertisement -