Viewing 15 posts - 7,501 through 7,515 (of 7,602 total)
INSERT INTO foundTable ( note_#, product_code )
SELECT n.note_#, p.product_code
FROM notesTable n
INNER JOIN productsTable p ON
n.notes LIKE '%' + p.product_code + '%'
...
December 1, 2011 at 3:52 pm
Any constraints will be verified before your trigger ever gets control. Thus, you cannot handle those types of errors in a trigger.
In general, you use BEGIN TRY ... END...
November 25, 2011 at 2:30 pm
Please post the valid formatting chars the existing function accepts and the expected output from sample formats.
#0.00, ### ##0.00
What specifically does that mean? I'm guessing the # is zero-suppressed...
November 25, 2011 at 2:22 pm
You don't actually need PATINDEX for that, LIKE will work just as well:
WHERE string LIKE ' [^ ]%' OR string LIKE '%[^ ] [^ ]%'
November 25, 2011 at 1:26 pm
This does not work if two or more people have the same total.
To paraphrase Clinton, it depends on the definition of "work". If two people have the same total,...
November 21, 2011 at 10:33 am
Don't see how you can do this w/o an ORDER BY, but it's trivial with one:
SELECT TOP 1 Name, SUM(Consumption) AS Total_Consumption
FROM tablename
GROUP BY Name
ORDER BY SUM(Consumption) DESC
November 21, 2011 at 9:40 am
Interesting code.
But can't use just do either of these:
DECLARE @result TABLE (value decimal(24, 4))
INSERT INTO @result
EXEC('SELECT 3.0 / 4 + 3.2')
SELECT * FROM @result
Or:
DECLARE @value decimal(24, 4)
EXEC sp_executesql N'SELECT @value...
November 21, 2011 at 9:37 am
Try something like:
REPLACE(REPLACE(column, CHAR(13), ''), CHAR(10), '')
Of course, CHAR(13) = cr, CHAR(10) = lf
December 21, 2010 at 12:12 pm
Ah, you mean exactly as I stated in the initial comment to your q? 🙂
December 9, 2010 at 1:03 pm
I don't think you have to do all that. Just change the first SELECT ... INTO statement:
...
PTS_QA_CE = CAST(Null AS decimal(10, 2)),
...
Btw, don't use decimal(10, 2) unless you really...
December 7, 2010 at 4:56 pm
Instead of a "CROSS JOIN" on the tally table, use an INNER JOIN, specifying the WHERE conditions relating to tally values as ON conditions instead.
December 7, 2010 at 1:46 pm
I don't know... you have 4 instances of CHARINDEX vs just 2
Quite true. A valid point.
3 of them are exactly the same function. Unfortunately, I...
December 7, 2010 at 12:44 pm
Technically, I think the first calc can be reduced ever so slightly 🙂 :
DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), -1) AS LastDayOfLastMonth
December 6, 2010 at 4:32 pm
I think you can do that more easily, like so:
SELECT SUBSTRING(col1, (CHARINDEX('Website is', col1) + 11),
CHARINDEX(' because', col1, (CHARINDEX('Website is', col1) + 11)) -
...
December 6, 2010 at 3:47 pm
You're pulling data from the comma forward, so you need a leading comma as well as a trailing one.
December 6, 2010 at 3:33 pm
Viewing 15 posts - 7,501 through 7,515 (of 7,602 total)