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
 Transact-SQL (2000)
 Blank Char Expression

Author  Topic 

Yucky
Starting Member

2 Posts

Posted - 2005-02-24 : 17:28:01
Hello everyone,
I'm a new SQL user and have a question about the expression syntax. I'm using SQL Server Enterprise Manager to create a new view. Every times I tried to concatenate Firstname and Lastname using Firstname + ' ' + Lastname it automatically changed it to Firstname + N' ' + Lastname.
Can anyone tell me what the "N" is for? I've searched online but couldn't find the answer.

Thanks,

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-02-24 : 18:08:24
The N is for unicode data. If you use the unicode data types, ntext nvarchar nchar, then you'll want to use that N.

Also, don't use Enterprise Manager to write code. Use Query Analyzer:

CREATE VIEW v_SomeView
AS

SELECT FirstName + ' ' + LastName AS CustomerName
FROM Table1
WHERE...


Using Enterprise Manager to build queries can sometimes lead to very inefficient queries. About a month ago, I saw a developer do it to create a query to be run in production. Enterprise Manager had picked CROSS JOIN for the join type. This is so not what he wanted. My eyes just rolled to the back of my head when I saw it, then I came to my senses and asked if I could drive.

Tara
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2005-02-24 : 18:12:26
Hey SQL Warrior Queen!

This is just a suggestion, but this is a question that proves there is a need on this site for sonmething like SQL Code FAQs. This one particular question gets asked almost every week.

And after all the repeat questions I've asked , I'm sure this thought has crossed your warrior mind, yes?

Semper fi,

XERXES, USMC(Ret.)
------------------------------------------------------
Once a Marine ALWAYS a Marine!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-02-24 : 18:15:54
Agreed. I don't run this site though nor am I moderator. You might want to start a thread like this in the Site Discussions forum. Bill (aka graz, site owner), Damian (aka Merkin, moderator), and Rob (aka robvolk, moderator)will probably read it and respond.

Tara
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2005-02-25 : 12:10:13
quote:
Originally posted by tduggan

Agreed. I don't run this site though nor am I moderator. You might want to start a thread like this in the Site Discussions forum. Bill (aka graz, site owner), Damian (aka Merkin, moderator), and Rob (aka robvolk, moderator)will probably read it and respond.

Tara



SQL Warrior Queen,

I have taken your advice and fired off an e-mail to Graz! I also mentioned you. Thanks!



Semper fi,

XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!
Go to Top of Page
   

- Advertisement -