Viewing 15 posts - 32,611 through 32,625 (of 59,102 total)
jared-709193 (9/8/2011)
The main way for a given month is this: SELECT DAY(DATEADD (m, 1, DATEADD (d, 1 - DAY(GETDATE()), GETDATE())) - 1)
That will give you the...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 9, 2011 at 12:56 am
I took the minimalist approach which also avoids the loop which would allow it to be used in an iTVF (unlike looping solutions). You might be able to speed...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 9, 2011 at 12:37 am
SQLRNNR (9/8/2011)
jared-709193 (9/8/2011)
SQLRNNR (9/8/2011)
SET DATEFORMAT DMY
DECLARE @StartDateDATE = '05/06/2011'
,@EndDateDATE = '31/08/2012'
;
WITH getmonths AS (
SELECT cast(Convert(varchar,'01/' + cast(MonthNum as varchar) + '/' + cast(yr.yr...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 9, 2011 at 12:33 am
BW_Toro (9/8/2011)
I use WITH EXECUTE AS 'dbo' in order to allow the TRUNCATE TABLE statement...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 10:56 pm
notoriousdba (9/8/2011)
Jeff Moden (9/8/2011)
Fine... I don't like your implication. 😉
Fair enough.:-P
Heh... you had me doubting myself 😉 Inference was the word I was looking for because it appeared that...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 10:44 pm
LutzM (9/8/2011)
Jeff Moden (9/8/2011)
Consider which letters may occur between ZA9999 and ZZZZZZ. You can spell some pretty offensive words with just the 5 letters. 😉
Now, I realize that...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 12:20 pm
LutzM (9/8/2011)
Jeff Moden (9/7/2011)
SQLServerMS (9/7/2011)
I need to populate the values for a column in a sequential manner as below, these need to be auto generated:
i1st it starts with
000001
000002
......
999999
A00001
A00002
......
A99999
B00001
......
B99999
......
Z99999
ZA0001
......
ZA9999
......
ZZZZZZ
How can...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 11:43 am
notoriousdba (9/8/2011)
Jeff Moden (9/8/2011)
notoriousdba (9/8/2011)
References, or it didn't happen.
I AM the reference! 😉 Do it your way and embarass your company and possibly get sued for offending someone's sensibilities....
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 11:37 am
nellisjp (9/8/2011)
Edit: Jeff beat...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 10:22 am
notoriousdba (9/8/2011)
Jeff Moden (9/7/2011)
notoriousdba (9/7/2011)
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 10:15 am
wiltc-836148 (9/8/2011)
Jeff Moden (9/8/2011)
GapEnd = hi.MyID - 1
which would have little effect...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 10:12 am
Then there's a much better and faster way to do it. You need random numbers from 1000 to 99999999, right?
SELECT CAST(ABS(CHECKSUM(NEWID())) % 99998999 + 1000 AS VARCHAR(8))
The...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 7:10 am
wiltc-836148 (9/8/2011)
Your gap detection code is very sweet...
However, I'm wondering what you think of the use of a tally table vs your gap detection if the requirement is to find...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 8, 2011 at 6:45 am
CELKO (9/5/2011)
tim.kay (9/2/2011)
--Jeff Moden
Change is inevitable... Change for the better is not.
September 7, 2011 at 7:05 pm
See the following article for how the method Cold Coffee used works.
http://www.sqlservercentral.com/articles/T-SQL/63681/
To see how to post data in the future to help us help you better, please see the first...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 7, 2011 at 7:00 pm
Viewing 15 posts - 32,611 through 32,625 (of 59,102 total)