Viewing 15 posts - 6,271 through 6,285 (of 8,416 total)
The only SQLCLR feature I haven't found a good use for so far is the SQLCLR trigger. Would anyone care if those were removed?
What I would like to see...
February 2, 2010 at 1:12 am
dips056 (2/1/2010)
if u have primary key on table then just the trap the error by@@ERROR
and generate error with RAISERROR ('Duplicate Record')
But the idea is to insert...
February 1, 2010 at 10:14 pm
February 1, 2010 at 9:57 pm
You are welcome. I particularly like the MERGE syntax - and it produces an arguably neater plan, avoiding a table spool. Do let us know how you get...
February 1, 2010 at 9:29 pm
Isn't the academic year just YEAR(DATEADD(MONTH, -7, {date_time}))?
USE tempdb;
CREATE TABLE #Data
(
date_time DATETIME ...
February 1, 2010 at 9:26 pm
In any case, here are a couple of alternatives:
-- New Transactions
CREATE TABLE #Transactions
(
TranIdBIGINT PRIMARY KEY,
TranDateDATETIME,
TranCodeVARCHAR(4),
AmountMONEY
);
-- Existing Transactions
CREATE TABLE #VendorExport
...
February 1, 2010 at 8:54 pm
I assume:
INSERT INTO @VendorExport
SELECT * FROM @Transactions
WHERE NOT EXISTS(SELECT TranId FROM @Transactions)
should say:
INSERT INTO @VendorExport
SELECT * FROM @Transactions T
WHERE NOT EXISTS(SELECT * FROM @VendorExport VE WHERE VE.TranId = T.TranId)
...?
February 1, 2010 at 8:47 pm
IGNORE_DUP_KEY seems like a magic bullet doesn't it? Be aware though that nothing is for free. When this option is enabled on an index, SQL Server has to...
February 1, 2010 at 6:52 pm
asashank82 (2/1/2010)
February 1, 2010 at 4:52 am
Flo's second option (don't insert duplicates) is normally by far the best option of those presented so far.
The best way to achieve that depends on factors which you have not...
February 1, 2010 at 4:47 am
Also consider not storing such strings in the database in the first place. If the original source of this data is a file, you can use any of the...
February 1, 2010 at 4:35 am
Lynn,
Yes. DATETIME2 does not support the add operator:
[font="Courier New"]Msg 8117, Level 16, State 1, Line xx
Operand data type datetime2 is invalid for add operator.[/font]
Adding dates directly has always seemed...
January 31, 2010 at 5:10 pm
Mike C (1/30/2010)
Hope that helps with the search for the UDF 🙂
Oh right - well thanks for that.
January 31, 2010 at 4:58 pm
Hey Flo,
Good to see you around on here again.
Excellent point about the limitation of INSERT...EXEC - the inability to nest calls is the main reason I try to avoid this...
January 31, 2010 at 4:52 pm
Viewing 15 posts - 6,271 through 6,285 (of 8,416 total)