Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
[code] DECLARE @ParmDefinition nvarchar(4000), @intRowCount int SET @ParmDefinition='@intRowCount int OUTPUT'; SET NOEXEC ON; EXECUTE sp_executesql 'Select 1',@ParmDefinition, @intRowCount OUTPUT; SET NOEXEC OFF; select @intRowCount[/code]How do I make the above return 1 instead of NULL?
DECLARE @ParmDefinition nvarchar(4000) DECLARE @intRowCount int SET @ParmDefinition='@intRowCount int OUTPUT'; SET NOEXEC ON; EXEC sp_executesql N'Select @intRowCount = 1', @ParmDefinition, @intRowCount=@intRowCount OUTPUT; SET NOEXEC OFF;
returns NULL and I have to declare @intRowCount or get a must declare the variable message.How do I make it work?
Thanks. Can't remember why I used NO EXEC it in the first place.
adlo
Posting Yak Master
108 Posts
Posted - 2010-06-16 : 12:55:46
I tried to use no exec for the below scenario to try resolve it but I can see it has no point as it always returns null.http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=146138It is a different issue so I created a separate thread for it.