Viewing 15 posts - 61 through 75 (of 109 total)
I can't believe I'm still doing this:
USE [collect2000]
GO
/****** Object: UserDefinedFunction [dbo].[tvf_ScrubData] Script Date: 05/21/2013 17:29:25 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tvf_ScrubData]')...
May 21, 2013 at 5:45 pm
Here's some sample data to throw at it.
select * from
(
select '01/01/2013' as data
union all select '01-02-2012'
union all select '01-03-2010'
union all select '123'
union all select '-123'
union all select '10:30'
union all select...
May 21, 2013 at 3:25 pm
It's an inline tvf that scrubs data by type using LIKE.
int, decimal (signed and unsigned), date, time, date time.
For those situations where data just gets stuck in a varchar field...
May 21, 2013 at 12:56 pm
well, because your query is a catch-all-query, it's going to be a table scan, which will not be efficient at all; read a little bit more hear:
http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/
It doesn't...
May 21, 2013 at 12:49 pm
Just for completeness sake, you never use more than one UNION, which is the last one. All the rest should be UNION ALL.
May 16, 2013 at 7:09 am
But that query doesn't have
where not exists(select 1 from Test_Elevations where productid = field1)
like the original did.
oops, I guess it did.
Maybe if you put it at the end?
April 5, 2013 at 2:18 pm
Apparently something in your select is generating duplicate rows. Try it without the INSERT and the problem should become evident. As a quick check, try adding a DISTINCT. The varchar(30)...
April 5, 2013 at 8:02 am
What do you get when you do this?
select * from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where CONSTRAINT_NAME = 'PK__ELEVATIONS__7B5130AA'
April 5, 2013 at 7:03 am
Nothing can take the place of someone who takes it personally when the system sucks. It may be 'only a job', but programmer isn't what I do, it's who I...
April 5, 2013 at 6:58 am
The table you're selecting from has duplicate project ids. Try
SELECT PROJECTID,COUNT(*) FROM BLAH GROUP BY PROJECTID HAVING COUNT(*) > 1
To identify the problematic row(s).
April 5, 2013 at 6:49 am
In keeping with the terseness of your post...
PIVOT
:w00t:
April 5, 2013 at 6:42 am
Adam hit it right on the head.
March 13, 2013 at 4:30 pm
Why not combine not updating the time in DOB with this?
IF UPDATE(DOB)
BEGIN
UPDATE P
SET DOB = dbo.fn_ReplaceTimeInDate(i.DOB)
FROM dbo.Patient P INNER JOIN
inserted i ON
P.PatientID = i.PatientID
...
March 6, 2013 at 4:56 pm
select icn, DateDiff(dd,min(fromdt),isNull(max(todt),GETDATE())) daycnt from icns
group by icn
February 22, 2013 at 7:09 pm
Now I'm really curious. What does changing a table structure have to do with SQL programming skills?
--Jeff Moden
I'm sure you've seen this hundreds of times before - you're one of...
January 29, 2013 at 10:37 pm
Viewing 15 posts - 61 through 75 (of 109 total)