« first day (3920 days earlier)      last day (26 days later) » 

5:55 AM
@CadeRoux It's always easier to do this sort of thing offline in a maintenance window. People invent ways to do it online with triggers and whatnot, but it is easy to shoot yourself in the feet.
If you choose locking, you have to test very carefully that things will be happy being blocked for that long, won't block the table rename, deadlock, or one of a hundred different things.
 
@McNets 100 times should be just 'bout right.
Morning
@McNets Thanks for your now deleted answer. Would you care to undelete it, just to include an alternate solution?
 
6:28 AM
@CadeRoux To anticipate one possible next question:
5
A: Request Sch-M lock on a table

Paul WhiteThere are any number of ways to do literally what you ask, but I would generally advise against using any of them. In most cases, all you need do is prevent any changes to the table while your process completes. This can be done with a TABLOCKX hint inside the transaction: SELECT TOP (0) NULL FRO...

 
6:53 AM
morning
@JohnK.N. sure
 
 
7 hours later…
1:32 PM
Good morning
 
2:02 PM
@PaulWhite It will be in a manual maintenance window by support on the customer's system, but if I can make it a little more resistant to them forgetting to stop services because they didn't read the instructions. I put in TABLOCK, HOLDLOCK on the source table on the initial SELECT INTO and am going to do a few more tests to see what happens if someone tries to insert before the table is dropped and the new one swapped in.
 
2:16 PM
luv 2 work in other people's databases. "LST_UPDT_TS" - it's a date.
Also, we're a fortune 500 company, pretty sure we can afford vowels.
 
2:37 PM
@CadeRoux Ok.
 
 
2 hours later…
4:38 PM
I know BTCH_IND is supposed to be "Batch Indicator" but I will continue reading it the wrong way because I've never matured past 14.
2
 
 
2 hours later…
6:46 PM
Heh, at the mutual fund company, we too suffered due to the great vowel scarcity. Tables and fields had to be less than 12 or 18 characters due a DB2 limitation. Thus it always was. Until I looked up the constraints and it was much larger than what that.
My naive assumption was that would get BATCH_INDICATOR as the good lord intended. Instead, I got SCHM_NM_TBL_NM_BTCH_INDCTR
I went from SSMS intellisense being difficult to you gotta be kidding me
3
 
I call it Welsh Case
Sorry, Achos Cymraeg
 

« first day (3920 days earlier)      last day (26 days later) »