Viewing 15 posts - 7,576 through 7,590 (of 7,612 total)
Excellent article!
Regarding the commission example, to consider something specific, I would prefer to explicitly know that a commission does not apply. Therefore, I might add a "IsCommissionEligible" BIT column. This is, most...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
April 10, 2007 at 10:11 am
You also need to add an ORDER BY, otherwise you can't be sure the code rows will be returned in sequence:
SELECT ...
ORDER BY id, colid
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 23, 2007 at 7:52 am
If the base table is small, you can do this:
SELECT *
FROM #tmpSumTest
UNION ALL
SELECT CAST(SUM(number) AS DECIMAL(19, 8))
FROM #tmpSumTest
If not small, you can make the main query a subquery, adding...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 22, 2007 at 7:43 am
Yes, you'll have to change the query for that.
To get tables with '%school%' in them:
1) AND must match all the other criteria, do this:
WHERE o.name LIKE N'%school%'
AND o.xtype = ''U'' AND o.name...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 5, 2007 at 12:08 pm
D'OH, sorry, change the TINYINTs to SMALLINTs.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 1, 2007 at 9:07 am
I assume you know the column type is char/varchar/nchar/nvarchar. If not, remove the check for "%char%"; if you know it's varchar, naturally you can change it to "%varchar%".
For one db:
SELECT...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 1, 2007 at 8:37 am
> Kill connections is pretty good. <
No, it's not - ALTER DATABASE should be used.
And if you really want to issue specific KILLs, you can do it something...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 28, 2006 at 9:27 am
Sorry, correct, I mis-read the original q.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 27, 2006 at 4:31 pm
Try looking at table "syscolumns". It includes not just table columns but also stored procedure columns
.
For example:
SELECT *
FROM syscolumns WITH (NOLOCK)
WHERE id...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 27, 2006 at 3:17 pm
Change @Qry from VARCHAR(5000) to VARCHAR(8000).
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 27, 2006 at 3:14 pm
I too don't like a "t"|"tb[l]" prefix, no least of all because a view can be changed to a table and vice-versa. Column prefixes, of any type, are even worse.
I do...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 14, 2006 at 10:01 am
No, "wrong situation" refers primarily to an application being added to the server. And not necessarily a full-blown business app either.
Say, instead, Java applets are added to the server. ...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
August 21, 2006 at 11:10 am
>> How much memory does SQL use on startup? <<
I disagree about the relevance of this q. This knowledge is not only useful but vital for a senior DBA. Otherwise,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
August 21, 2006 at 9:18 am
Split the varchar and int portions for storage purposes only. You can still combine them for display, etc..
So, create two new columns, one varchar and one (small)int, copy the existing...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 25, 2006 at 9:28 am
I recommend (Philip) Pratt's "A Guide to SQL". I used it for db classes I taught and thought it was excellent for students.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 25, 2006 at 9:15 am
Viewing 15 posts - 7,576 through 7,590 (of 7,612 total)