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
priya ppp
NA
16
8.6k
Query to get the count
Jan 12 2016 11:54 PM
Hi to every one ..I want to get a count from variable ,please check the below query
'DECLARE @PATOIDS VARCHAR(MAX) ' +
'DECLARE @Pat VARCHAR(MAX) '+
'SET @PATOIDS = '''' ' +
'SELECT @PATOIDS = @PATOIDS + CAST(PATIENTOID AS VARCHAR) + '','' ' +
'FROM (SELECT DISTINCT PATIENTOID ' +
'FROM @CNT) TMP ' +
'IF LEN(@PATOIDS) > 0 ' +
'SET
@PATOIDS
= SUBSTRING(@PATOIDS, 1, LEN(@PATOIDS) - 1)'
In the above query '@PATOIDS' contains multiple values , to print the values in @PATOIDS,am using the statement like
'DECLARE @PATOIDS VARCHAR(MAX) ' +
'DECLARE @Pat VARCHAR(MAX) '+
'SET @PATOIDS = '''' ' +
'SELECT @PATOIDS = @PATOIDS + CAST(PATIENTOID AS VARCHAR) + '','' ' +
'FROM (SELECT DISTINCT PATIENTOID ' +
'FROM @CNT) TMP ' +
'IF LEN(@PATOIDS) > 0 ' +
'SET @PATOIDS = SUBSTRING(@PATOIDS, 1, LEN(@PATOIDS) - 1)'+
+
'PRINT(@PATOIDS)'
but the out put contains the values along with comma separated values but I want to print the count of @PATOIDS, so can any one tell me how to get the count??
Reply
Answers (
1
)
What is SqlDependency?
How to sync sql server database with mysql database?