How to Declare array in stored procedure. Adding values to array through query. and iterating through a loop for array elements in mssql stored procedure .
-
1There are no arrays on SQL Server, can you clarify what you want?, it sounds like you want to iterate through rows from a table.Lamak– Lamak2013-02-07 14:04:24 +00:00Commented Feb 7, 2013 at 14:04
-
Yes exactly. I need to iterate through rows from a table. How can i do this in stored procedure without array.user1881251– user18812512013-02-07 14:09:26 +00:00Commented Feb 7, 2013 at 14:09
-
1You might also want to give more information about why you want to loop over a table. In SQL Server code you should usually avoid doing that if possible, although there are certainly times when it's necessary. If you can explain more about what your problem is, someone may be able to help you avoid a loop completely.Pondlife– Pondlife2013-02-07 14:20:30 +00:00Commented Feb 7, 2013 at 14:20
-
I need to check if perticular entry is present in the table if present then update else insert. I have multiple rows of data and i need to check each rowuser1881251– user18812512013-02-08 04:05:01 +00:00Commented Feb 8, 2013 at 4:05
-
Updating else inserting (also referred to as a merge or sometimes an "upsert") has been asked about dozens of times already. I suggest you review the existing questions and if you're still stuck then explain what you've tried and why it isn't working.Pondlife– Pondlife2013-02-14 21:36:00 +00:00Commented Feb 14, 2013 at 21:36
Add a comment
|
2 Answers
TSQL does not provide arrays. Use table variables instead.
2 Comments
user1881251
How can i iterate through a column in table
user1881251
I have multiple rows of data and i need to check each row