New Members FAQ
Execute dynamic sql in function
Hello friends ,
this is probably one my post which took me so long to varify but negligible time to write it .
We cannot execute dynamic sql in a user defined funtion.
SET @query = 'select * from nytable'
exec (@query) – this will not work
neither you can call any stored procedure from a function(except extended stored procedures).
the another possible workaround for this is that you create a stored procedure rather than a UDF or create an extended stored procedure . than you can call it as
Get Day Name
Ranking Functions in SQL Server 2005
Decode sql functions
Find the LENGTH of a string without using LEN Function in Sql Server
SQL DATE Time Convert
Example of SQL Server Case Conversion Functions
Date - Time Formatting in SQL
Security Principals for SQL Server
SQL Script to Concatenate column values
Read related articles:
Execute dynamic sql function
Dynamic function SQL
Did you like this resource? Share it with your friends and show your love!
Responses to "Execute dynamic sql in function"
No responses found. Be the first to respond...
Notify me by email when others post comments to this article.
Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
No HTML formatting and links to other web sites are allowed.
This is a strictly moderated site. Absolutely no spam allowed.
to fill automatically.
(Will not be published, but
to validate comment)
Type the numbers and letters shown on the left.
6 important uses of Delegates and Events
Return to Resources
Post New Resource
Post resources and
Diffrence between SCOPE_IDENTITY, IDENT_CURRENT, and @@IDENTITY ?
Introduction to UDL in SQL
MSSQL 2005 Error: Cannot recover the master database
New Features in SQL Server 2008
Tag posting guidelines
Execute dynamic sql in funtion
Last 7 Days
Naved Hasan ...
Awards & Gifts
Articles Rss Feeds
Forum Rss Feeds
Talk to Webmaster Tony John
Revenue Sharing sites
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2013 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.