Viewing 15 posts - 196 through 210 (of 287 total)
There are no system tables being triggered, so you should be fine.
July 28, 2009 at 1:11 pm
I was messing around a bit since I haven't mess with DDL triggers before.. this seems to work:ALTER TRIGGER Test
ON DATABASE
FOR CREATE_TABLE
AS
IF NOT EXISTS
(
...
July 28, 2009 at 12:52 pm
Not 100% sure about being able to do the check in a trigger. As far as I know you can get at the CREATE statement.. But, then I think you'd...
July 28, 2009 at 12:41 pm
Untested, but something like this I think will work:SELECT
*
FROM
INFORMATION_SCHEMA.TABLES AS T
LEFT OUTER JOIN
(
SELECT
Table_Name
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
DATA_TYPE = 'datetime'
AND IS_NULLABLE = 'NO'
AND
(
Column_Name = 'creation_date'
OR Column_Name = 'last_modified_date'
)
GROUP BY
Table_Name
HAVING...
July 28, 2009 at 12:20 pm
It's been a while since I set up my stored procedure template with error handling, but I *think* you need to use the ERROR_NUMBER() function inside the CATCH block. But,...
July 28, 2009 at 11:35 am
I don't see any need to get XACT_ABORT on for that code. It should fail on the PK violation and jump to the CATCH. Unless I'm missing something thing..?
SET XACT_ABORT...
July 27, 2009 at 1:17 pm
UPDATE ScoreTable
SET sore_id = sore_id + 13107
July 24, 2009 at 2:13 pm
I've run into instances where and NOT LIKE are not necessarily the same (actually, = and LIKE). Here is an example, possibly more obscure than any real data. But,...
July 24, 2009 at 1:58 pm
I can't answer your question directly as I do not have much experience with linked servers, and frankly I do not like them. But, you might want to look into...
July 24, 2009 at 1:49 pm
The main issue is the substring: SELECT substring(@data_nv,1,10)
Maybe this will help:declare @data_nv nvarchar(500)
declare @data_numeric DECIMAL(15,2)
SET @data_nv = '2.0018430861853059e-005'
SELECT CAST(@data_nv AS FLOAT)
SELECT CAST(CAST(@data_nv AS FLOAT) AS DECIMAL(38,25))
SELECT CAST(CAST(CAST(@data_nv AS FLOAT) AS...
July 24, 2009 at 12:57 pm
@SQL (7/21/2009)
The problem with linkedservers in SQl 2005 is that it first copies the data into a temp table on local server and then to your base table which makes...
July 24, 2009 at 12:48 pm
Can you explaine how you calcualted those values? I'm totaly missing how you go them.
July 24, 2009 at 12:27 pm
What is your expected output?
See if this works for you:SELECT
DISTINCT O2.*
FROM
tmpOrders AS O1
INNER JOIN
tmpOrders AS O2
ON O1.RecordID O2.RecordID
AND O1.ProductID = O2.ProductID
AND O1.OrderDate = O2.OrderDate
AND O1.ProductClass = O2.ProductClass
AND...
July 23, 2009 at 5:17 pm
If I understand you you could use a Numbers/Tally table and join to that.. For example:-- SET UP
DECLARE @Numbers TABLE (Num INT)
INSERT @Numbers
SELECT 1
UNION ALL SELECT 2
UNION ALL SELECT 3
UNION...
July 23, 2009 at 3:40 pm
Hehe, I was goofing around and came up with a solution, albeit poor, that works for the sample data. YMMV:DECLARE @TABLE2 TABLE (NewPart_No int,OldPartNo int,Sno int IDENTITY(1,1))
INSERT INTO @TABLE2(NEWPART_NO,OLDPARTNO) VALUES(1,3)
INSERT...
July 23, 2009 at 2:33 pm
Viewing 15 posts - 196 through 210 (of 287 total)