Viewing 15 posts - 226 through 240 (of 1,315 total)
You can create a view based on sys.extended_properties, and then define INSTEAD OF triggers to turn normal DML statements into EXEC sp_add/update/dropextendedproperty calls. This code was written and tested...
September 27, 2013 at 5:57 am
The sp_MSforeachdb procedure uses dynamic SQL, so it would not qualify as a completely non-dynamic version. I can't think of a good way to do something like this with...
August 13, 2013 at 5:48 pm
I spotted that one, as well as "SET @LaborVal = (select b.LaborValue from Buffer b where b.BufferYear = datename(YY,getdate()))" later.
These could be rewritten several ways. They all will execute...
August 1, 2013 at 10:38 am
You should rewrite the query so there is only one parameter.
SELECT Value = CASE WHEN Arg = '19000101' THEN GETDATE() ELSE Arg END FROM (SELECT Arg = ?) a
or even
DECLARE...
August 1, 2013 at 10:19 am
There is a link at the end of the article under "Resources" to a .sql file with all the views and procedures.
July 8, 2013 at 6:52 am
After turning your sample into valid XML, I was able to query it with T-SQL
DECLARE @xml XML = '
<CompoundLogData>
<ArrayOfEntry>
<Entry>
...
May 30, 2013 at 1:52 pm
If you're picky about the scripting options, and you have to do this on multiple databases, and especially if this is going to be a recurring task, you probably should...
April 3, 2013 at 2:02 pm
There are many ways, look up articles on tally tables.
A small range like 0..160 is easy.
SELECT TOP 161 number = ROW_NUMBER() OVER (ORDER BY object_id) - 1
FROM master.sys.all_columns
Or create a...
January 25, 2013 at 5:46 pm
TRUNCATE TABLE dbo.dim_Quarter ;
-- The need for both QuarterID and RecordID is not clear, presumably the QuarterID sequence has a different base value
DECLARE @offset INT = 1000 ;
INSERT INTO dbo.dim_Quarter...
January 25, 2013 at 12:10 pm
I would take a different approach. Not necessarily better, but different.
I would avoid the cursor and the immediate EXEC(), instead just use a query to produce the desired script...
October 2, 2012 at 7:07 pm
RE: Multiple environments on the same server
Using user name instead of (or in addition to) host name is probably the easiest way to handle having multiple environments on the same...
September 18, 2012 at 8:40 pm
In the WHERE clause you need to put parenthesis around all the OBJECTPROPERTY conditions.
WHERE (OBJ()=1 OR OBJ()=1 OR ...) AND definition LIKE ...
or even join the OBJECTPROPERTY function results with...
August 14, 2012 at 1:21 pm
The package could be hanging up on some non-SQL task, so SQL Profiler may not be the solution.
Using SSIS logging sounds like a better idea. You could even throw...
June 8, 2012 at 11:43 am
Hugo Kornelis (5/3/2012)
--------------------------------------------------------------------------------
What bothers me (about the documentation referenced, not about this question) is the relative order of ON and JOIN - how can the ON be processed without first...
May 8, 2012 at 11:52 am
The spt_values table is a great source of number sequences from 0 to 2048, the CTE is overkill in this case in my opinion.
SELECT MoNum = number,
...
March 14, 2012 at 6:55 am
Viewing 15 posts - 226 through 240 (of 1,315 total)