Reputation: 3449
I'm new to SQL and am now working with stored procedures. I was watching another developer's code and I saw this statement:
ALTER PROCEDURE [deleteRecords_UNICODE]
@RecordIDs ty_NumberList READONLY
Question 1: What does the "ty_NumberList" mean?
Question 2: I'm creating a stored procedure that needs to use the above parameter.
When I created "DECLARE @RecordNum int", I obviously got the error of
Operand type clash: int is incompatible with ty_NumberList
I'm guessing I have to resolve this by:
a) Creating a variable of type "ty_NumberList"
b) then go with my usual DECLARE @RecordNum int
c) Then pass the value of @RecordNum into ty_NumberList
Question 3: How would I go about implementing the above steps in SQL?
Any help would be greatly appreciated!
Upvotes: 4
Views: 724
Reputation: 128
Read this
ty_number means you have to tell us because its a user defined data type
while declaring the stored procedure parameter
we no need to use declare
create proc sample @name vanchar(20), @num varchar(20) Begin
Select ........ .......
End
Upvotes: 0
Reputation: 135171
That code is using Table-Valued Parameter
s, read up on it in Books On Line: http://msdn.microsoft.com/en-us/library/bb510489.aspx
Upvotes: 1
Reputation: 453897
ty_NumberList
is the type of a table valued parameter.
You would use it like
DECLARE @Nums AS ty_NumberList;
INSERT INTO @Nums VALUES (1);
EXEC YourProc @Nums;
Upvotes: 4