Viewing 15 posts - 106 through 120 (of 125 total)
Having a read of this article should help you:
June 29, 2010 at 10:05 am
Very odd!
I tried it with:
WHERE ParsedString LIKE '%[0-9]%'
and it came up with the same error, but actually returned the first string (ID = 1)
I also tried it with cross apply...
June 4, 2010 at 10:08 am
When you order by the "createddate" it is sorting them in order of the days, rather than the date itself. You could sort by the original date value crdate desc
Have...
June 4, 2010 at 9:29 am
Paul White NZ (5/27/2010)
UPDATE LazyMaddySET cpnt = LazyMaddy.q
FROM (
SELECT T.cpnt,
...
May 28, 2010 at 8:05 am
Try this:
DECLARE
@StartDateDATETIME,
@EndDateDATETIME;
--Use DATEADD/DATEDIFF to get the start of the month/day/hour etc
SELECT
@StartDate= DATEADD(HH,DATEDIFF(HH,0,'2010-01-01 01:50:00.000'),0),
@EndDate= DATEADD(HH,DATEDIFF(HH,0,'2010-01-31 01:30:00.000'),0);
;WITH DateRange (DateRange) AS
(
SELECTDATEADD(HH, (T.N-1), @StartDate)
FROMTally AS T
WHERET.N - 1 <= DATEDIFF(HH, @StartDate, @EndDate)
)
SELECT DateRange FROM...
May 21, 2010 at 4:23 am
I'd certainly be interested to see any other methods people have to compare.
Also, I'm sure I've read on this forum at some point that it may be slightly more efficient...
May 20, 2010 at 2:45 am
I think this does what you want, but I would probably have another think about how the table designed if you can
DECLARE @test-2 TABLE
(
ProjectID CHAR(15),
DepartmentID CHAR(7),
[Month] INT,
[Year] INT,
ID...
May 13, 2010 at 10:29 am
I believe you can also use the QUOTENAME function here
http://msdn.microsoft.com/en-us/library/ms176114.aspx
SELECT'EXEC Sproc '
+ '''value_1'''...
May 11, 2010 at 10:33 am
Your code seemed to work ok for me, the only thing I noticed was you missed the close parenthesis on the create table statement:
IF OBJECT_ID(N'Tempdb..#ProductTest', N'U') IS NOT NULL
DROP...
April 30, 2010 at 3:15 am
Nice! Was wondering if anyone could find a way to get the Nth value without having to add in extra code for every new character needed. Although that code you...
April 28, 2010 at 8:02 am
When I first read this I thought the same as Jeff and managed to find a very interesting thread with some examples of how to do it (1=A, 26=Z,...
April 27, 2010 at 8:26 am
It seemed to be mostly correct, apart from you missed out an AND operator on your DML statement and it required a little rejig
IF OBJECT_ID(N'Tempdb..#CallLog', N'U') IS NOT NULL
DROP...
April 27, 2010 at 4:20 am
If you want to sort them by Number part of the string (i.e. Comp5 comes before Comp10) you could rename the alias names slightly when you do your pivot to...
April 26, 2010 at 9:39 am
This should hopefully do the trick
--Create Our Varchar Date Test Table
IF OBJECT_ID(N'Tempdb..#D', N'U') IS NOT NULL
DROP TABLE #D
GO
CREATE TABLE #D
(
IDINT IDENTITY(1,1),
DateVARCHAR(8)
PRIMARY KEY CLUSTERED (ID)
);
INSERT INTO #D (Date)
SELECT '20100422' UNION...
April 23, 2010 at 6:32 am
Thanks to Paul it should now be a little more robust when dealing with certain collations
IF OBJECT_ID(N'CharTest', N'U') IS NOT NULL
DROP TABLE CharTest
GO
CREATE TABLE CharTest
(
/* Using "full text" on...
April 21, 2010 at 4:50 am
Viewing 15 posts - 106 through 120 (of 125 total)