Viewing 15 posts - 646 through 660 (of 5,356 total)
You can use multiple CASE expressions in a query. Basically as much as you need. You can also net CASEs with other CASEs. I don't have a better example right now...
April 7, 2005 at 2:51 am
It would be helpful, if you can provide the code, along with sample data and desired output.
April 7, 2005 at 2:23 am
I think a better question is, why do you want to use a cursor at all?
April 7, 2005 at 1:08 am
Yes, the leaf level of a clustered index is actually the data itself. You might also want to specify WITH DROP EXISTING in the CREATE INDEX statement. Should speed up...
April 7, 2005 at 12:52 am
May I ask, what's the purpose of this exercise here?
April 6, 2005 at 8:43 am
Dinesh's solution will work.
dt% implies dt_%. So as long as your own naming convention doesn't use dt as beginning, it really shouldn't matter what you use.
April 6, 2005 at 7:18 am
http://www.sommarskog.se/dynamic_sql.html
Erland also discusses there the use of both dynamic sql and cursors. Worth reading.
Now, if you don't mind something undocumented, have a look here:
http://www.rac4sql.net/xp_execresultset.asp
April 6, 2005 at 6:28 am
Piggy-backing on alzdba, what about this?
SELECT
CASE
WHEN DAY(GETDATE()) > 14
THEN DATEADD(mm,1,DATEADD(DAY,1-DAY(GETDATE()),DATEDIFF(d,0,GETDATE())))-1
ELSE DATEADD(mm,1,DATEADD(DAY,15-DAY(GETDATE()),DATEDIFF(d,0,GETDATE())))
END
April 6, 2005 at 2:53 am
April 6, 2005 at 2:09 am
Hm, maybe you're right.
I guess that just because I am married with children. At home I almost never have the last word.
April 6, 2005 at 1:55 am
Sure, this works, but you know that you should prefer using the INFORMATION_SCHEMA views instead of direct querying the system tables if you can?
April 6, 2005 at 1:48 am
For IN and EXISTS I think this is a ggod explanation by Itzik Ben-Gan:
http://groups.google.de/groups?hl=de&lr=&selm=uFffAFPaBHA.1900%40tkmsftngp04
April 5, 2005 at 8:58 am
Three to be precise here.
Obviously, but I look better that way .
Now if I recall this...
April 5, 2005 at 8:55 am
Yes but this time I was replying to myself as new ideas came to me. And it wasn't pointless chatting like this
Just another definition for the same thing....
April 5, 2005 at 8:40 am
Viewing 15 posts - 646 through 660 (of 5,356 total)