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)
 Alternate for Quotename

Author  Topic 

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-04-01 : 08:26:07
Dear gurus,

Is there any optional and alternate solution for the function
Quotenam(),Do the needful.

Thanks in advance,
Dass

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-01 : 08:27:11
What's wrong with using Quotename()?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-04-01 : 08:31:01

Dear Harsh Athaily,

I want to use this optional for dynamic declaration of integer.





quote:
Originally posted by harsh_athalye

What's wrong with using Quotename()?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-01 : 08:33:39
Not sure what you mean by that.

Could you give some example to clarify?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-04-01 : 08:44:38

this is the sample query

set A=
'select * from Table_name where id '=+Dynamic integer
exec (A)
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-01 : 08:51:40
What's need of Dynamic SQL and Quotename() here?

This can be achieved quite easily as below:

Declare @p int

Set @p = 27 -- some dynamic integer

select * from Table_name where id = @p


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-04-01 : 08:58:54
Ya you are right,we can have the
result by (select * from tb_name where id= @d )
but can you solve my problem, which i have told in the last reply.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-01 : 09:06:13
Use CAST or CONVERT instead.

set @A = 'select * from Table_name where id ' + cast({Dynamic integer} AS varchar(12))

exec (@A)


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-01 : 09:07:47
quote:
Originally posted by Peso

Use CAST or CONVERT instead.

set @A = 'select * from Table_name where id = ' + cast({Dynamic integer} AS varchar(12))

exec (@A)


E 12°55'05.25"
N 56°04'39.16"




Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -