Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
zzaaqq1112003
Starting Member
4 Posts |
Posted - 2003-02-27 : 02:29:56
|
| Hi,A newbie question:how can I generate or append/insert text to the result of a select, I can do something like this from oracle:select 'append this text '||number||';' from abcThis queries does not care what data type of 'name' is and it will output: append this text 123456;can I do something like this with a simple select, I dont want to use precedure or function.Ta |
|
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2003-02-27 : 07:17:22
|
| Yes you can.Select 'My Name is ' + namecolumn + '.'From TableYou will however have to cast any columns that are nor character type columns. For instance, an int column would look something like:Select 'The Number of records returned is ' + cast(count(*) as varchar(20))From TableJeremyEdited by - joldham on 02/27/2003 07:18:08 |
 |
|
|
zzaaqq1112003
Starting Member
4 Posts |
Posted - 2003-02-27 : 07:46:26
|
| thanks for this, I think I can also do ltrim(columname). Either way (cast or ltrim), is a bit more complicated than what I use to :) |
 |
|
|
|
|
|