Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Assign value to variable inside Dynamic SQL

DECLARE @result INT
       ,@query NVARCHAR(MAX);

SET @query = '
  SET @result= 1';

EXEC sp_executesql @query, N'@result INT OUTPUT',@result =  @result OUTPUT

SELECT @result;
Comment

PREVIOUS NEXT
Code Example
Sql :: restart mysql 
Sql :: oracle ddl 
Sql :: add foreign key to existing table 
Sql :: postgresql remove duplicate rows 2 columns 
Sql :: postgresql newline character 
Sql :: oracle error line 
Sql :: update table sql multiple set 
Sql :: postgresql escape single quote 
Sql :: sql rename column in select query 
Sql :: show function mysql 
Sql :: find a column by name in a sql server table 
Sql :: postgresql delete all content 
Sql :: SQL get last 5 minutes data 
Sql :: count in sql 
Sql :: postgresql héritage 
Sql :: commit transaction sql 
Sql :: mysql select row with max value group by 
Sql :: order by number of character in sql 
Sql :: soql update query 
Sql :: get current date sql 
Sql :: Write SQL in ruby on rails 
Sql :: sql left join with where clause 
Sql :: mysql date_format 
Sql :: sql select data type of query 
Sql :: mysql pad zeros 
Sql :: peewee print sql 
Sql :: create postgres role and database for bitbucket 
Sql :: oracle boolean to varchar 
Sql :: order of execution in sql 
Sql :: split string and copy last element postgresql 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =