Sql Set Result Of Select. If the SELECT statement returns more than one value the variable is assigned the last value that is returned. SET is used to assign a value to a variable and SELECT is used to assign a value or to select value from a variabletableview etc.
I use dynamic SQL a lot but I do it slightly different. The SET command is used with UPDATE to specify which columns and values that should be updated in a table. 20 January 2021.
To change the column name and column data type at runtime while executing a stored procedure.
If the SELECT statement returns more than one value the variable is assigned the last value that is returned. There are 2 ways of assigning a value to a local variable previously created with the DECLARE LocalVariable statement namely using the SET and the SELECT statements. SET is used to assign a value to a variable and SELECT is used to assign a value or to select value from a variabletableview etc. The data returned is stored in a result table called the result-set.