Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Location
    Edmonton Alberta Canada
    Posts
    41

    Unanswered: Concat int with string

    Hi,

    I am trying to concat an int with an nvarchar in my select:

    select distinct(id + name)
    from load
    where name not like '%test%'

    but I am getting an error saying:
    Server: Msg 245, Level 16, State 1, Line 1
    Syntax error converting the nvarchar value '灪愭楮敭' to a column of data type int.

    My question is: how do you concat int and string in MS SQL Server. The equivalent in Oracle would be ||, I think.

    Thanks for any help.

    Mongo

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    did you try this --

    select distinct(cast(id as nvarchar) + name) ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •