I had to create a script for dropping constraints on a table – no problem if the constaint is a named default, but if the default has a system generated name, it gets a bit hairy. Here’s an example of how the defaults get created:
Create table TestTable1
(TestConst datetime default Getdate())
Go
I googled this and found Pinal Dave had [...]
Here’s a simple script that I use often – a quick hitter to find table row counts, that doesn’t use the Select Count(*). It uses the sysindexes table thus the reason it’s called “fairly accurate”.
SELECT
[TableName] = so.name,
[RowCount] = MAX(si.rows)
FROM
sysobjects so,
sysindexes si
WHERE
so.xtype = 'U'
AND
si.id = OBJECT_ID(so.name)
GROUP BY
so.name
ORDER [...]
Here’s a script I created to determine when I was going to be at specific miles for a marathon. It’ll give you your miles per hour and your minutes per mile. Then it’ll calculate at what time you will be at different mile marks.
Set nocount on
Declare @FTime datetime,
@Dist float,
@RStartTime datetime,
@BDown float
———————————–
—-Change these for [...]
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
– Creates a header for scripts –
– Pastes [...]