In Oracle’s PL-SQL, you can declare a variable and define its type based on a table column:
declare var1 table.column%TYPE;
Is it possible to do something similar in MS SQL Server?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No you can’t do this. The closest equivalent is
User-Defined Data Types. This will give you a layer of abstraction that may help, but it is not the same as deriving a type from a column.