Jump to content

Archived

This topic is now archived and is closed to further replies.

maliary

[SOLVED] Append String to SQL value

Recommended Posts

 

Hello,

 

I have this SELECT datediff(day,1999.03.09,1999.03.19) this returns 10. I would like to append the word day to this result.

 

I have tried this SELECT datediff(day,1999.03.09,1999.03.19)+' '+Days but it doesn't work.

 

Any ideas ?

Share this post


Link to post
Share on other sites

SELECT CONCAT(datediff(day,1999.03.09,1999.03.19),' Days')

Share this post


Link to post
Share on other sites

 

It gives an error. Concat is not a recognised built in function name.

Share this post


Link to post
Share on other sites

Perhaps if you told us what SQL database type you are using.

Share this post


Link to post
Share on other sites

Try this:

 

SELECT    { fn CONCAT(CAST(DATEDIFF(day, '1999-03-09', '1999-03-19') AS varchar(100)), ' Days') }

 

{edited}

 

or just:

 

SELECT CAST(DATEDIFF(day, '1999-03-09', '1999-03-19') AS varchar(100))+' Days'

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.