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.
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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
|
 |
|
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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
dass05555
Yak Posting Veteran
55 Posts |
Posted - 2008-04-01 : 08:44:38
|
this is the sample queryset A='select * from Table_name where id '=+Dynamic integerexec (A) |
 |
|
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 intSet @p = 27 -- some dynamic integerselect * from Table_name where id = @p Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
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. |
 |
|
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" |
 |
|
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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|