Viewing 12 posts - 1 through 12 (of 12 total)
Is it possible to redefine the XML schema and do without the elements ColorWhite, ColorBlack, etc?
If so, some version of the following simplified SQL could apply:
select
a.AccountNo as "Account/AccountNo"
...
January 24, 2012 at 2:44 pm
The following may be a good starting point for the desired results. NOTE: You may want to create portions of this SQL dynamically if there are many different colors to...
January 21, 2012 at 6:25 am
You could use a SUM Window function as an alternative...
select
TranCode
,TranDescription
,TranDescription
,sum(TranAmount) over (partition by TranCode) as TranCodeTotal
from @transactions
order by TranCode
December 24, 2011 at 9:57 pm
In SS2005, the following may be another possibility:
select * from emp where empid in
( select i.value('text()[1]','int')
from (select cast('<i>'+replace(@str,',','</i><i>')+'</i>' as xml) as xlist) s
cross apply s.xlist.nodes('/i') X(I)
)
December 12, 2011 at 4:48 am
As a quick proof of concept, you could start with something like...
select cast(newid() as sysname)
-- OR --
print cast(newid() as sysname)
November 23, 2011 at 6:51 pm
If I understand the expected results correctly, the following would be a possible solution using an rCTE:
declare @StartDevice varchar(32) ,@EndDevice varchar(32);
select @StartDevice = 'G9' ,@EndDevice = 'BIN200';
;with cte as
(
...
November 23, 2011 at 5:31 pm
Could you use results returned from the following?
SELECT
StaffId
,ClientId
,MIN(Date) AS FirstDate
,MAX(Date) AS LastDate
,DATEDIFF(ww ,MIN(VisDate) ,MAX(VisDate)) as Weeks
FROM [dbo].[Visits]
GROUP BY StaffId ,ClientId
November 17, 2011 at 4:06 am
If you FETCH INTO a @BusinessEntityID variable, SSMS will not display anything by default:
BEGIN
SET XACT_ABORT ON
SET NOCOUNT ON
DECLARE @BusinessEntityID INT -- Or VARCHAR(128), Perhaps?
...
November 16, 2011 at 7:33 pm
I think this could be accomplished with an rCTE in SQL.
November 13, 2011 at 2:27 pm
Would something like the following be useful?
DECLARE @t TABLE
(
Node int null
,Parent int null
);
INSERT @t (Node ,Parent)
SELECT 1 ,null UNION ALL
SELECT 2 ,1...
November 12, 2011 at 8:13 am
sql:variable cannot be used for an XPath expression - it's really a bind variable for specific XML element or attribute values.
However, what if you created some dynamic SQL with the...
November 10, 2011 at 4:33 am
Suckishly? ¿Por qué? I've seen otherwise, but, I'm curious to know the instances where CTEs have performed poorly. Are you working in a data warehouse environment? ...
November 3, 2011 at 4:48 pm
Viewing 12 posts - 1 through 12 (of 12 total)