Re: Help concatenating non string fields

Re: Help concatenating non string fields

 

  





What are the datatypes for Dbo.ID and dbo.ReportsId ?

I'm sure there's a more elegant way of doing this, but this seems to work
for starters:

declare @Num1 int
declare @Num2 int

Set @Num1 = 300
Set @Num2 = 5

select cast(cast(@num1 as varchar(3)) + cast(@num2 as varchar(3)) as
int)


hth,
JJMontgomery






"Justin Gilli"
<[Email Address Removed]
.com> To
"LazyDBA.com Discussion"
12/18/2003 09:38 <[Email Address Removed]
AM cc

Subject
Help concatenating non string
fields










I am trying to concat two non sting fields.
For example :

(Dbo.Id) +''+(dbo.ReportsId)
300 5 = 3005

but I am getting the addition of these two (305) instead of them being
appended to each other(3005).
I have tried Cast and converting the values from int to varchar but it
still adds them.

Any advice?


Sincerely,

Justin Gilli









---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page