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.
Hai,I just wanna know that can we implement FOR statements in stored procedures. If, yes can you describe it with an example.NarayanaMoorthy
dinakar
Master Smack Fu Yak Hacker
2507 Posts
Posted - 2007-08-09 : 12:35:18
nope. what exactly are you trying to do?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/
Lamprey
Master Smack Fu Yak Hacker
4614 Posts
Posted - 2007-08-09 : 12:40:17
If you mean a FOR-loop, then you can use a WHILE loop to imitate it. Otherwise, SQL has a FOR claue:
USE AdventureWorks;GOSELECT ContactID, FirstName, LastName, PhoneFROM Person.ContactWHERE LastName LIKE 'G%'ORDER BY LastName, FirstName FOR XML AUTO, TYPE, XMLSCHEMA, ELEMENTS XSINIL;
BOL is your friend.
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2007-08-10 : 01:53:53
quote:Originally posted by NarayanaMoorthy Hai,I just wanna know that can we implement FOR statements in stored procedures. If, yes can you describe it with an example.NarayanaMoorthy
You can use WHILE Loop but you should explain what you want to doMadhivananFailing to plan is Planning to fail