Apr 11, 2007 #1 zemp Programmer Joined Jan 27, 2002 Messages 3,301 Location CA SQL Server 2000 SP4 Is there a way to show the finished SQL statement from within a stored procedure that dynamically creates it. Even if all that can be done is to send it to a file. zemp
SQL Server 2000 SP4 Is there a way to show the finished SQL statement from within a stored procedure that dynamically creates it. Even if all that can be done is to send it to a file. zemp
Apr 11, 2007 #2 SQLDenis Programmer Joined Oct 1, 2005 Messages 5,575 Location US sure use print and look at the message tab Denis The SQL Menace -------------------- SQL Server Code,Tips and Tricks, Performance Tuning Google Interview Questions Upvote 0 Downvote
sure use print and look at the message tab Denis The SQL Menace -------------------- SQL Server Code,Tips and Tricks, Performance Tuning Google Interview Questions
Apr 11, 2007 #3 SQLDenis Programmer Joined Oct 1, 2005 Messages 5,575 Location US example Code: use pubs go declare @tableName varchar(50), @sql varchar(500) select @tableName ='orders' select @sql = 'select * from ' + @tableName exec(@sql) print @sql Denis The SQL Menace -------------------- SQL Server Code,Tips and Tricks, Performance Tuning Google Interview Questions Upvote 0 Downvote
example Code: use pubs go declare @tableName varchar(50), @sql varchar(500) select @tableName ='orders' select @sql = 'select * from ' + @tableName exec(@sql) print @sql Denis The SQL Menace -------------------- SQL Server Code,Tips and Tricks, Performance Tuning Google Interview Questions
Apr 11, 2007 Thread starter #4 zemp Programmer Joined Jan 27, 2002 Messages 3,301 Location CA Forgive me, but I can't find the message tab that was mentioned. Where is it? zemp Upvote 0 Downvote
Apr 11, 2007 #5 SQLDenis Programmer Joined Oct 1, 2005 Messages 5,575 Location US in query analyzer Denis The SQL Menace -------------------- SQL Server Code,Tips and Tricks, Performance Tuning Google Interview Questions Upvote 0 Downvote
in query analyzer Denis The SQL Menace -------------------- SQL Server Code,Tips and Tricks, Performance Tuning Google Interview Questions