Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hi,
    I'm trying to conver this query from Access to SQL Server 2005. I can get everything by the syntax for the new column that is a combination of [username]&""&[password].

    SELECT [username] & "" & [password] AS UsernamePassword, tblUsernamePassword.SecurityLevel, tblUsernamePassword.Username, tblUsernamePassword.Password, tblUsernamePassword.Active, tblUsernamePassword.EmployeeName
    FROM tblUsernamePassword;


    Thanks!
    Leesha

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    Inplace of [username]&""&[password]
    try
    [username] + ' ' + [password]

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Concatenating with an empty string "" has no effect, so if you really want to concatenate username and password with nothing in between, you can use

    SELECT [username] + [password] AS UsernamePassword, ...

  4. #4
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks Pat! Worked like a charm!

    Leesha

  5. #5
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks Hans. I always appreciate the help. The access sql was working but if this is the right way to do it then of course that is my goal!

    Leesha

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    SQL Server uses + instead of & to concatenate strings.

    The extra "" didn't do any harm, but it didn't serve any purpose either. Concatenating any string with "" results in that string:

    "Leesha" & "" = "Leesha"

    "Woody" & "" & "Leonhard" is the same as "Woody" & "Leonhard". Both result in "WoodyLeonhard".

Posting Permissions

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