IT Community - Software Programming, Web Development and Technical Support

Difference Between Exec() and sp_executesql in Sql Server

This is a discussion on Difference Between Exec() and sp_executesql in Sql Server within the Database Support forums, part of the Web Development category; Difference Between Exec() and sp_executesql The difference between the EXEC() and sp_executesql is that the former takes SQL statement in ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 01-19-2008, 02:18 AM
vadivelanshanmugam vadivelanshanmugam is offline
D-Web Trainee
 
Join Date: Jan 2008
Posts: 36
vadivelanshanmugam is on a distinguished road
Default Difference Between Exec() and sp_executesql in Sql Server

Difference Between Exec() and sp_executesql

The difference between the EXEC() and sp_executesql is that the former takes SQL statement in a string as parameter. But in case of the latter, it is a system procedure whose first parameter is a parameterized SQL statement. The second parameter is a parameter-list declaration, similar to the parameter list present in the declaration of a stored procedure. And the remaining are simply the parameters in that parameter-list. So the query built using this method is always same whenever it gets called but the user input changes which will be supplied at runtime.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
system, exec, passthru - tried them all - now I'm at a loss kenrojas1 PHP Programming 0 12-30-2008 07:56 AM
What is the difference between UNION and UNIONALL in SQL Server? bluesky Database Support 1 07-25-2007 04:53 AM
What is the difference between Server.Transfer and Response.Redirect? Why would I cho prasath ASP and ASP.NET Programming 1 07-19-2007 01:41 AM
Difference in for & foreach, exec vadivelanvaidyanathan Perl 0 07-15-2007 06:16 PM
Difference between Client-Server & Web Testing vadivelanvaidyanathan Software Testing 0 03-14-2007 04:51 AM


All times are GMT -7. The time now is 05:21 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0