• Convert Access Query to SQL Server 2005

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Convert Access Query to SQL Server 2005

    Author
    Topic
    #461473

    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

    Viewing 1 reply thread
    Author
    Replies
    • #1171077

      Inplace of [username]&””&[password]
      try
      [username] + ‘ ‘ + [password]

    • #1171078

      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, …

      • #1171120

        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

        • #1171121

          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”.

    Viewing 1 reply thread
    Reply To: Reply #1171077 in Convert Access Query to SQL Server 2005

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel