Viewing 15 posts - 466 through 480 (of 1,439 total)
A mix of the two seems to help
SELECT @HOLDER = ID
FROM #testEnvironment
WHERE CHARINDEX('.', yourData COLLATE Latin1_General_BIN2 , CHARINDEX('.', yourData COLLATE Latin1_General_BIN2) + 1) = 0;
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 25, 2012 at 6:56 am
Use sp_executesql with OUTPUT variables
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 18, 2012 at 3:09 am
DECLARE @t TABLE(value VARCHAR(10),xml_1 XML)
INSERT INTO @T(value,xml_1)
VALUES('1+2','<root><s>1</s><s>2</s></root>'),
('3+4','<root><s>3</s><s>4</s></root>')
SELECT value,x.r.value('.','INT') AS s
FROM @t
CROSS APPLY xml_1.nodes('/root/s') AS x(r)
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 15, 2012 at 1:48 am
Not sure this will help but I seem to remember something similar. Turned out the problem was the database owner, setting the owner to 'sa' using sp_changedbowner fixed it.
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 10, 2012 at 10:49 am
Did you really want it lowercase?
SELECT (SELECT LOWER(FirstName) AS "text()"
FROM #temp
ORDER BY ID
FOR XML PATH(''),TYPE).value('.','NVARCHAR(4000)') AS OutPut;
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 9, 2012 at 6:17 am
Try this
WITH Range(MINDATE,TotalDays) AS (
SELECT MIN(DATECOL),
DATEDIFF(Day,MIN(DATECOL),MAX(DATECOL))
FROM #SAMPLETABLE),
CTE AS (
SELECT n.number+1 AS number,
ROW_NUMBER() OVER(PARTITION BY CASE WHEN...
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 7, 2012 at 3:05 am
prady_1988 (10/5/2012)
The values under Relationship is taken from 2 tables.
Table1 -> AssetID, AssetName
Table2 -> Relationship1
Table3 -> Relationship2
Table4 -> Company
Hence for each record I am getting...
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 5, 2012 at 6:44 am
prady_1988 (10/5/2012)
Mark-101232 (10/5/2012)
Try this
SELECT AssetID, AssetName, MAX(Relationship) AS Relationship, MAX(Company) AS CompanyFROM myTable
GROUP BY AssetID, AssetName
Thanks Mark, but the problem is "Relationship" and "Company" columns are from different tables. Hence...
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 5, 2012 at 6:26 am
Try this
SELECT AssetID, AssetName, MAX(Relationship) AS Relationship, MAX(Company) AS Company
FROM myTable
GROUP BY AssetID, AssetName
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 5, 2012 at 6:11 am
I've waited five years, but finally I've got a reply!
http://www.sqlservercentral.com/Forums/FindPost1368501.aspx
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 4, 2012 at 9:34 am
WITH Recur(EmployeeID,Employee,ManagerID,Manager,Level) AS (
SELECT EmployeeID,Name,ManagerID,CAST('SuperBoss' AS NVARCHAR(100)) ,1
FROM #DataToBeReOrdered
WHERE ManagerID IS NULL
UNION ALL
SELECT d.EmployeeID,d.Name,d.ManagerID,r.Employee, r.Level+1
FROM #DataToBeReOrdered d
INNER JOIN Recur r ON r.EmployeeID =...
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 4, 2012 at 8:08 am
SELECT UniqueID,ID,Name,
(SELECT Latitude,
Longitude
...
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 3, 2012 at 5:16 am
This may also work for you
case
when ', ' + @myVar + ', ' like '%, ' + ProdGrpCode + ', %' then '82'
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 1, 2012 at 7:45 am
PiMané (10/1/2012)
SELECT nc1, class, nc2 FROM #nc t WHERE NOT EXISTS (SELECT 1 FROM #nc t0 WHERE t0.nc1 = t.nc2 AND t0.nc2 = t.nc1 AND t.nc2...
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 1, 2012 at 7:30 am
SELECT nc1,class,nc2
FROM #nc
EXCEPT
SELECT nc2,class,nc1
FROM #nc
WHERE nc2 > nc1
ORDER BY class,nc1,nc2
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
October 1, 2012 at 5:11 am
Viewing 15 posts - 466 through 480 (of 1,439 total)