Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
can i get result of EXEC sp_executeSQL as...
can i get result of EXEC sp_executeSQL as record set?
Rate Topic
Display Mode
Topic Options
Author
Message
sumith1andonly1
sumith1andonly1
Posted Wednesday, October 31, 2012 11:25 PM
Valued Member
Group: General Forum Members
Last Login: Sunday, May 05, 2013 11:09 PM
Points: 66,
Visits: 260
DECLARE @query nvarchar(MAX) ;
set @query = 'SELECT * FROM Products' ;
EXEC sp_executeSQL @query
is this query return the record set as normal 'SELECT * FROM Products' query?
Post #1379622
BriPan
BriPan
Posted Wednesday, October 31, 2012 11:35 PM
SSC Journeyman
Group: General Forum Members
Last Login: Friday, March 01, 2013 6:16 AM
Points: 81,
Visits: 286
Yes it will.
with respect to performance it may different. but result will be same
Post #1379623
dwain.c
dwain.c
Posted Wednesday, October 31, 2012 11:37 PM
SSCrazy
Group: General Forum Members
Last Login: Today @ 8:37 PM
Points: 2,370,
Visits: 3,252
While it will, you won't be able to manipulate results in the client.
To do that, you'd need to INSERT into a temporary table within the dynamic SQL. That table, defined in advance in the client, would then contain the results of the query in the temp table, which could then be used in the client.
Obviously, you should not use SELECT * (use explicit column names).
No loops! No CURSORs! No RBAR! Hoo-uh!
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Are you too recursively challenged?
Splitting strings based on patterns can be fast!
Post #1379624
sumith1andonly1
sumith1andonly1
Posted Thursday, November 01, 2012 1:42 AM
Valued Member
Group: General Forum Members
Last Login: Sunday, May 05, 2013 11:09 PM
Points: 66,
Visits: 260
thanks
Post #1379651
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.