Viewing 7 posts - 1 through 7 (of 7 total)
For this example, why even use LIKE?
SELECT
S.TTR_ID
,S.TTR_TXT
FROM dbo.TBL_TEST_RX S
--WHERE S.TTR_TXT LIKE '[%][ ]%';
WHERE LEFT(S.TTR_TXT, 2) =...
July 30, 2015 at 7:47 am
Anyone actually check this code?
I believe the RANK statement in the CTE is incorrect (see corrected version below) if the intent is to remove duplicates for ItemNumber only. At...
July 27, 2010 at 12:27 pm
Actually for readability, this one's even better,
It has only 32 "words" compared to your 70,
182 non-space characters to your 363,
and runs just as fast:
select
u.UserID
, stuff((
select ', ' +...
June 29, 2010 at 3:10 pm
OK, then use GROUP:
--An alternative without ROW_NUMBER()
--How about this?
select
u.UserID
, stuff((
...
June 29, 2010 at 2:48 pm
--An alternative without ROW_NUMBER()
--How about this?
select distinct
u.UserID
, stuff((
select ', ' + u2.RoleName
from @UserRole u2
where u2.UserID = u.UserID
and u2.RoleAssignedDate = (
select min(u3.RoleAssignedDate)
from @UserRole u3
where u3.UserID = u2.UserID
and u3.RoleName = u2.RoleName
)
order by...
June 29, 2010 at 8:21 am
-- how about?
SELECT
pv.ProductID
, pv.Version
, pv.MinorVersion
, pv.ReleaseVersion
, pv.StandardCost
FROM Production.ProductVersion pv WITH (NOLOCK)
WHERE EXISTS (
SELECT *
FROM (
SELECT TOP 1
pv2.ProductID
, pv2.Version
, pv2.MinorVersion
, pv2.ReleaseVersion
FROM Production.ProductVersion pv2 WITH (NOLOCK)
WHERE pv2.ProductID =...
June 18, 2010 at 3:26 pm
Viewing 7 posts - 1 through 7 (of 7 total)