December 9, 2007 at 11:56 pm
Hi Experts,
I have written a query to print the ASCII values of A to Z.
Query:
-------------------------------
Declare @Start int,@End int
select @Start =ASCII('A')
select @End = ASCII('Z')
while @Start <= @End
Begin
select char(@Start),@Start
select @Start = @Start + 1
End
--------------------------------
Again , i want to avoid 'WHILE LOOP' which leads to RBAR Logic. I want to apply setbased logic to solve the above problem.
Experts inputs are welcome !
karthik
December 10, 2007 at 1:10 am
You are double posting... that'll get you thrown out of the "sandbox"... 😉
http://www.sqlservercentral.com/Forums/Topic431176-8-1.aspx
--Jeff Moden
Change is inevitable... Change for the better is not.
December 10, 2007 at 10:37 pm
Jeff,
No..This is a different one.Yes i want to print ascii values of A-Z.
Can i use the same logic where you replied for my previous question ?
Kindly tell me, in which situations we go for master.dbo.spt_values table ?
karthik
December 11, 2007 at 7:42 am
karthikeyan (12/10/2007)
Jeff,No..This is a different one.Yes i want to print ascii values of A-Z.
Can i use the same logic where you replied for my previous question ?
No, it's not different... exact same logic applies.
Kindly tell me, in which situations we go for master.dbo.spt_values table ?
I wouldn't... except for simple examples like I did on the other post where I'm sure the person asking doesn't have a Tally table... best thing to do is to use a Tally table, instead. I explain how to make one on the other post.
If you have any more questions on this, please use the other thread so all the questions and answers about this subject are on a single thread. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply