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.

 All Forums
 SQL Server 2000 Forums
 MSDE (2000)
 Hi everyone

Author  Topic 

davers
Starting Member

14 Posts

Posted - 2005-04-27 : 08:54:18
Good Morning everyone! I'm brand spanking new to MSDE so expect quite a few questions from me in the future. I've developed databases in Access...by never anything using SQL...so I'm at quite the disadvantage. My company has started asking me for more robust Database solutions, and I figured MSDE would be a good step up. I've managed to install MSDE on my computer at work, along with a Data Management Toolkit, MDAC 8, and myODBC 3.51. My very first question is how can I combine 2 fields in a query in MSDE like I do in Access. For instance, in my tblEmployee table, I have a field [LastName] and a field [FirstName]. I'd like to combine them like this:

myName: [LastName] & ", " & [FirstName]

that's how I would do it in Access...but MSDE doesn't like the & or the quotes...any idea how I can do this?

Thanks and have a good day,

Dave

Windows XP, Office XP

mfemenel
Professor Frink

1421 Posts

Posted - 2005-04-27 : 09:05:34
select lastname + ,' ' + firstname from tablename.
The + symbol is your concatenation operator in SQL Server. If you're trying to concatenate something and it's not a char or varchar data type you'll have to do a cast or convert such as:

select cast(employee_id as varchar(10)) + '-' + first_name from tablename.

Good luck. I'm sure we'll be hearing from you!

Mike
"oh, that monkey is going to pay"
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-04-27 : 10:49:17
advice: go out on your lunch break and buy a good book on beginning with SQL Server, so that things like syntax and other differences between SQL Server and Access won't constantly hold you up. I can't stress this enough. Like most other people, I also like to "dive in" and start playing with things, but unlike many others I always try to do what I can to make sure that I am prepared when I begin with a new technology by reading as many books as I can and having them handy as references.

- Jeff
Go to Top of Page

davers
Starting Member

14 Posts

Posted - 2005-04-27 : 10:56:12
Thanks for the help guys. I am going to buy a book or 2! That's the way I learned Excel and Access...

Thanks again for the help and have a good day,

Dave

Windows XP, Office XP
Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2005-04-27 : 14:47:13
and don't be afraid to look things up in BOL. It's one of the best resources (other than sql team).

Mike
"oh, that monkey is going to pay"
Go to Top of Page
   

- Advertisement -