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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 "can we use FOR statements in Stored Procedures"

Author  Topic 

NarayanaMoorthy
Starting Member

19 Posts

Posted - 2007-08-09 : 12:32:11
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/
Go to Top of Page

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;
GO
SELECT ContactID, FirstName, LastName, Phone
FROM Person.Contact
WHERE LastName LIKE 'G%'
ORDER BY LastName, FirstName
FOR XML AUTO, TYPE, XMLSCHEMA, ELEMENTS XSINIL;


BOL is your friend.
Go to Top of Page

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 do

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -