TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rahul Sharma
NA
289
81.8k
Storing value in localvariable from dynamic sql in sql
Dec 10 2014 9:43 PM
declare @EndDate varchar(50)
set @EndDate = '2014-11-17'
declare @monthend varchar(50)
set @monthend = 'select' + ' '+ 'MONTH('+ ''''+@EndDate+''''+')'
declare @flag int
set @flag = exec @monthend
select @flag
if @flag ='11'
I want to store result comes from dynamic query
@monthend
into variable
@flag
.
and use the value @flag in the if else condition.
Reply
Answers (
2
)
Dynamic value from Sql XML string using Geography DataType
How to load the last updated value from sql server 2012