Tuesday, March 27, 2012

Concat ?

Hi

I'm not sure about the right 'term' of this question. I'm using MS SQL server 2000 standard edition in a Windows 2003 Server Enterprise edition.

I have two tables. One of this has several columns (Year,Month,Day,User,Message). The other one, have just one column called Messages.

I count the today's messages in the first table using the following syntax

SELECT COUNT(*) FROM Tab1 WHERE YY = (datepart(year, getdate())) AND MM = (datepart(month, getdate())) AND DD = (datepart(day, getdate()))

Now, I have to update the column Messages in Table2, but I must to add a text before the count result. I.E.

'Messages today = 25'

Hoy may I add the text before the SELECT COUNT query result ?? Is it possible ??

Thank you.Try this syntax

select emp_id, 'Messages today = ' + convert(varchar(10),count(1)) from table group by empid

Prasad

No comments:

Post a Comment