October 16, 2008 at 7:36 am
looks like you have decided that it is a limitation...
so be it...
October 16, 2008 at 7:38 am
Karthik, so are you gonna say that your head is a limitation...:)
October 16, 2008 at 7:40 am
No....our eyes has the limitation.... :Whistling:
do you agree or not ?:D
karthik
October 16, 2008 at 7:50 am
is there any other command or clause that won't work directly with local variable ?
karthik
October 16, 2008 at 8:07 am
The from clause
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 16, 2008 at 8:16 am
karthikeyan (10/16/2008)
Glen,You are correct !
My point is, we can't use local variable in the order by clause directly.
do you agree ?
Without using dynamic SQL, that's correct.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
October 16, 2008 at 9:12 am
If you want multiple values in the list format you stated, you cannot. However, if you convert it to a local table variable and use that instead, you can accomplish exactly what you wanted without dynamic sql. Variables are always set to a single value, setting it to a list isn't really logical. See my examples above for both ways.
October 16, 2008 at 9:51 pm
karthikeyan,
limitation is not in variables, limitation in your knowlege of the language.
Not sure about juniors, but even medium level developers (developers, not system engineers) suppose to know the difference between values and identifiers.
And after all those training given to you on Tally table you still trying to do IN (@var) things.
I'm feel sorry for Jeff Moden who spent so much time and effort on educating you.
As I told him from the beginning, it was for nothing.
You need learn to learn first.
_____________
Code for TallyGenerator
October 17, 2008 at 1:49 am
Not sure about juniors, but even medium level developers (developers, not system engineers) suppose to know the difference between values and identifiers.
As a senior, you shouldn't discourage junior or medium level developers. You should know how to motivate peoples. Thats why the difference between senior and junior. Just you think where you stand.
karthik
October 17, 2008 at 1:54 am
And after all those training given to you on Tally table you still trying to do IN (@var) things.
I am not asking how to implement Tally table to replace IN(@var). If i asked that question, your point is valid.
Can you read the topic once again ? I haven't asked 'How to replace IN(@var) with tally table logic ?' , Suppose if i asked that question, again your point is valid. But the topic is 'Limitations of @ Local variable'.
My intention is to know the limitation of local variable or as some veteran developer said limitations of ORDER BY. I dont know how you are linking tally table training with this question.
karthik
October 17, 2008 at 2:10 am
I'm feel sorry for Jeff Moden who spent so much time and effort on educating you.
As I told him from the beginning, it was for nothing.
Sergiy,
My friend....Don't feel....Also don't insert your head unnecessarily in all the matter. Okay !
I have never wasted his time and effort spent on educating me.
Because i have implemented his Tally table concept in more than 20 stored procedures so far. I hope the list should grow in the future. I am ready to show all those procedures at offline, if you don't believe me.
And finally, how you have decided 'it was for nothing...' Don't give unnecessary comments without knowing completely. It will harm your life. It is my personal advice to you. It leads you to lot of problem.
karthik
October 17, 2008 at 2:38 am
Hey..Hey.....Sergiy
I am not fighting with you, I am ready to take all your comments,suggestions and advices. But there is a way to give all those things. The way you are saying is hurting other peoples.
Try to change the way you are approaching...
Happy weekend 🙂
karthik
October 17, 2008 at 2:50 am
Karthik,
I can give you set of other "variable limitations".
For example:
SELECT * FROM @Table
SELECT Value as @ValueName
GROUP BY @Column
etc.
All these are actually cases of misuse of language elements typical for beginners.
What means - RTFM!
And it does not matter how many procedures you put Tally table in.
If you cannot recognize the case when you need to use it - you still did not get the concept.
It's not a guess, it's for sure.
_____________
Code for TallyGenerator
October 17, 2008 at 3:10 am
do you mean to use like below
Create table #tmp
(
eno int,
ename varchar(25)
)
go
insert into #tmp
select 1,'Karthik'
union all
select 2,'Keyan'
union all
select 3,'Ravi'
go
Declare @Name varchar(50)
select @Name = 'Karthik,Keyan'
Select @Name = ',' + @Name + ','
Select eno,ename
from #tmp
where ename in (Tally table logic to split the values based on comma
)
karthik
Viewing 14 posts - 16 through 29 (of 29 total)
You must be logged in to reply to this topic. Login to reply