Can we use Array In SQL Server?
-
Can we use Array In SQL Server ,if yes can any body tell how to use the same. Is it possible to call a stored procedure recursively??? Any answer to the above questions will be highly appreciated
Can we use Array In SQL Server ? Yes..but using an indirect way : Create a temporary table like this :
CREATE TABLE #temp(Field1 INT PRIMARY KEY)
(put the above code in a stored proc or trigger etc..) note the # before the name of the table :#temp this makes the temporary table available for the current connection.. ## will make it available to all connections to free this table use:DROP TABLE #temp
Is it possible to call a stored procedure recursively? yes..but by default there is a limited number of nesting levels (31 I think) but you can change it.. hope this can help :) -
Can we use Array In SQL Server ? Yes..but using an indirect way : Create a temporary table like this :
CREATE TABLE #temp(Field1 INT PRIMARY KEY)
(put the above code in a stored proc or trigger etc..) note the # before the name of the table :#temp this makes the temporary table available for the current connection.. ## will make it available to all connections to free this table use:DROP TABLE #temp
Is it possible to call a stored procedure recursively? yes..but by default there is a limited number of nesting levels (31 I think) but you can change it.. hope this can help :) -
Thanx for ur valuable suggestions. Can i have a sample stored procedure which is called recursively.
Simply call the same stored proc again in the code: like this:
CREATE PROCEDURE MyProc AS . . --your code here . . exec MyProc . . GO
the nesting limit is 32 levels (this time i'm sure..got it from MSDN) you can test for the nesting level using :@@NESTLEVEL
like :select @@NESTLEVEL AS 'Outer Level'