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
 General SQL Server Forums
 New to SQL Server Administration
 how to use quotename function with comma

Author  Topic 

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2010-05-18 : 14:15:15
Hi all,

I am aware of this function but have bit confusion...
How can we use comma (') delimiter? I am trying to use it but it is giving me error:-

select quotename('sb',''')


Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark after the character string '')
'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '')
'.

How can i use comma?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-18 : 14:40:44
That isn't a comma. What you've posted is a single quote. A comma looks like this: ,

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-05-18 : 14:51:56
quote:
Originally posted by vijays3

Hi all,

I am aware of this function but have bit confusion...
How can we use comma (') delimiter? I am trying to use it but it is giving me error:-

select quotename('sb',''')


Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark after the character string '')
'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '')
'.

How can i use comma?


What exactly are you trying to do?
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2010-05-19 : 06:12:06
you want to know how de-limited identifier works...right???
if that is the question, answer is as follows
Example:
if you want to use a keyword as an object name, then you can use it. like...
create table [select](a int, b char(1))

in the same way, you can work with single Quotes also..(for some other options...not for create)

Tara, correct me if i'm wrong

Arnav
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2010-05-19 : 13:06:15

I am sorry i just misinterpreted ...i wanted to ask single quote..how can we use it.Thanks for correcting me

quote:
Originally posted by tkizer

That isn't a comma. What you've posted is a single quote. A comma looks like this: ,

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-19 : 13:24:01
A single quote can be masked by a second single quote:
select quotename('sb','''')


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2010-05-21 : 14:41:46
Thank yo
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-22 : 06:23:50
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -