SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sp_executesql returning blank resultset
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

subhaoviya
Posting Yak Master

India
129 Posts

Posted - 05/08/2013 :  06:41:05  Show Profile  Reply with Quote
hi while i am executing the below query, i am getting resultset with columns but no data.

DECLARE @sql NVARCHAR(max)
DECLARE @params NVARCHAR(4000)

SET @sql=N'exec MyStoredProcedure'
SET @params = N' @POSTCODE VARCHAR(20), @SURNAME VARCHAR(50),@HOMEPHONE VARCHAR(20),@MOBILE VARCHAR(20)
,@EMAIL VARCHAR(120) ,@D_INDIVIDUALID VARCHAR(200),@P_LEADID VARCHAR(200)'


EXECUTE SP_Executesql @sql,@params,'','','','','',1,''

but when i am executing
exec MyStoredProcedure @D_INDIVIDUALID =1

please help me to resolve the issue with sp_executesql

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 05/08/2013 :  06:49:39  Show Profile  Reply with Quote
it should be

DECLARE @sql NVARCHAR(max) 
DECLARE @params NVARCHAR(4000)

SET @sql=N'exec MyStoredProcedure @POSTCODE,@SURNAME,...'
SET @params = N' @POSTCODE VARCHAR(20), @SURNAME VARCHAR(50),@HOMEPHONE VARCHAR(20),@MOBILE VARCHAR(20)
,@EMAIL VARCHAR(120) ,@D_INDIVIDUALID VARCHAR(200),@P_LEADID VARCHAR(200)'


EXECUTE SP_Executesql @sql,@params,@POSTCODE=<value>,@SURNAME=<value>,...


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

subhaoviya
Posting Yak Master

India
129 Posts

Posted - 05/08/2013 :  06:57:20  Show Profile  Reply with Quote
Thanks a lot visakh it is working fine .
Go to Top of Page

zhulin
Starting Member

3 Posts

Posted - 05/08/2013 :  09:32:21  Show Profile  Reply with Quote
Thank you for sharing. Hope you will share more ideas and pictures, I wish you good luck.



__________________
zhulin
unspammed
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 05/08/2013 :  12:31:32  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000