Viewing 15 posts - 271 through 285 (of 1,438 total)
Regular expressions should do it
DECLARE @t TABLE(col VARCHAR(50))
INSERT INTO @t(Col)
VALUES
('411roadwork_08_eb.jpg'),
('sampletest.jpg'),
('15415286.JPG'), -- this one I need to match on
('091913notext3.jpg');
SELECT Col
FROM @t
WHERE REPLACE(Col,'.jpg','') NOT LIKE '%[^0-9]%';
October 7, 2013 at 9:14 am
WITH CTE AS (
SELECT *,
ROW_NUMBER() OVER(PARTITION BY [system_no] ORDER BY [event_date]) AS rn
FROM [event_history])
SELECT a.*
FROM CTE a
WHERE EXISTS(SELECT * FROM CTE b WHERE...
October 4, 2013 at 4:58 am
Have a look at Dwains excellent article
http://www.sqlservercentral.com/articles/CROSS+APPLY+VALUES+UNPIVOT/91234/
October 4, 2013 at 3:30 am
SELECT t.[AGE],ca.[Rate],ca.[Amount]
FROM [dbo].[Sheet1$] t
CROSS APPLY (VALUES([2#00%], [2#25%]), ([2#50%], [2#75%]), ([3#00%], [3#25%]), ([3#50%], [3#75%])) ca([Rate],[Amount])
October 4, 2013 at 3:16 am
Try this
select * from _dates d
left outer join cannedbackupjobs dbj on d.d = CONVERT(VARCHAR(10), dbj.starttime, 120)
where d.d between (select min(starttime) from cannedbackupjobs) and (select max(starttime) from cannedbackupjobs);
October 2, 2013 at 7:34 am
Use a calendar table
October 2, 2013 at 7:11 am
dwain.c (9/30/2013)
Mark-101232 (9/30/2013)
WITH CategoriesWanted([Category]) AS (
SELECT [Category]
FROM ( VALUES (3),(6)) x([Category])
)
SELECT [Project]
FROM [dbo].[Project_Category]
WHERE [Category] IN (SELECT [Category] FROM CategoriesWanted)
GROUP BY [Project]
HAVING...
October 1, 2013 at 1:33 am
WITH CategoriesWanted([Category]) AS (
SELECT [Category]
FROM ( VALUES (3),(6)) x([Category])
)
SELECT [Project]
FROM [dbo].[Project_Category]
WHERE [Category] IN (SELECT [Category] FROM CategoriesWanted)
GROUP BY [Project]
HAVING COUNT(DISTINCT [Category])=(SELECT...
September 30, 2013 at 7:31 am
WITH CTE AS (
SELECT InvoiceNumber, FranchiseLoc, Distribution,
ROW_NUMBER() OVER(PARTITION BY InvoiceNumber, FranchiseLoc ORDER BY Distribution) AS rn
FROM InvoiceLine)
SELECT a.InvoiceNumber,
...
September 24, 2013 at 9:12 am
DECLARE @t TABLE(Empid INT,Empskills VARCHAR(3))
INSERT INTO @t(Empid ,Empskills)
VALUES
(1, 'C'),
(1, 'CPP'),
(1, 'VB'),
(2, 'C'),
(2, 'CPP'),
(3, 'C'),
(4, 'CPP');
SELECT t.Empid,
STUFF((SELECT ',' + t2.Empskills AS "text()"
...
September 24, 2013 at 7:50 am
You can to do it dynamically
EXEC('
UPDATE e
SET
e.SourceColumn2 = t.ThisColumnDoesNotExist
FROM DoesNotIncludeColumn t
JOIN DestinationTable e
ON t.Column1 = e.SourceColumn1')
September 20, 2013 at 9:19 am
SELECT TOP 1
...
ORDER BY c.column_id DESC
September 20, 2013 at 7:44 am
batgirl (9/16/2013)
born2achieve (9/16/2013)
your example showing...
September 17, 2013 at 1:42 am
May be as simple this
SELECT Key, Month, MAX(Usage) AS Usage
FROM myTable
GROUP BY Key, Month
September 16, 2013 at 8:57 am
Viewing 15 posts - 271 through 285 (of 1,438 total)