Viewing 15 posts - 196 through 210 (of 445 total)
Mark, looks like OP needn't restrict rows by r.NextVALUE = o.VALUE only by MACHINE_NUMBER.
P.S. I mean (MACHINE_NUMBER, EVENT_DATE) is unique i guess. If not, VALUE must...
April 21, 2015 at 6:47 am
See http://www.sqlservercentral.com/Forums/Topic1676473-3412-1.aspx
Quirky update or recursive CTE is needed.
April 21, 2015 at 5:33 am
Shouldn't it be
and
--nullif(a.CurrXRate, 0) is null
nullif(CurrXRate, 0) is not null
order by CurrXDate desc
?
And when selecting only one value...
April 21, 2015 at 5:09 am
Because they are different queries. Consider the first subquery of those queries. Suppose t2 has one row (col2=10, col3=300) and t1 rows are
(col1=5, col4=100),
(col1=5, col4=300).
In the first...
April 17, 2015 at 5:52 am
MSSS has no other char string datatype with it's max length greater then 8000 but Varchar(max). So you definetly need Varchar(max). Or XML or varbinary(max) if you prefer. What's...
April 16, 2015 at 12:50 pm
Explanation says "The result of using XML Data methods will always be nondeterministic. "
It's not correct. Just add WITH SCHEMABINDING
CREATE FUNCTION dbo.ReturnSecIdFromClientXML (@ClientXML XML)
RETURNS CHAR(1)
WITH...
April 16, 2015 at 5:26 am
It may be you needn't. Toid is meant to be used in a expression kinda select.. where .. fromid <x.id<=toid. And yes, LAG() or something is...
April 15, 2015 at 2:39 am
Recursive CTE will do the job and it can be faster then cursor but hardly outperforms quirk update.
CREATE TABLE #TEMP (ID int, DateCreated datetime, IsDoubleLag bit)
INSERT INTO #TEMP VALUES...
April 14, 2015 at 1:42 pm
ON DELETE CASCADE really places a lot of locks , log is growing badly and it's rather slow. But when trying do it 'by hand' with a number of smaller...
April 14, 2015 at 8:08 am
Use FOR XML PATH('') .See http://stackoverflow.com/questions/4944680/flatten-sql-server-table-to-a-string
for example.
April 14, 2015 at 5:24 am
Hardly it's possible with pure SQL or SSIS.
You need some pdf-aware soft, MS Word for example. Create vba macro which will retrieve proper images from DB and place it in...
April 14, 2015 at 3:01 am
A bit more details we need to answer. As a starting point try subqueries
WITH finance AS
(SELECT 200.12 AS fare,
12.78 AS VAT,
45.5 AS Tax
UNION ALL
SELECT 150.12 AS fare,
...
April 7, 2015 at 6:06 am
Mike Byrd (4/4/2015)
SELECT e1.EntityIdentity as CompanyID
FROM dbo.Entitye1 --company
JOIN dbo.EntityAssociationea
ON e1.EntityID = ea.EntityID1
JOIN dbo.Entitye2 --user
ON ea.EntityID2 = e2.EntityID
This query occurs as a sub-query...
April 6, 2015 at 8:10 am
If performance isn't a concern simply run
select * from t
where @strname like '%'+text+'%'
Do expect full table scan.
April 3, 2015 at 5:06 am
XML attributes can be embedded using [@attrname] = .. syntax with FOR XML
select
(select [@bgcolor]='red', object_name( object_id ) for xml path ('td'), type),
(select count( distinct name ) for xml...
April 2, 2015 at 5:58 am
Viewing 15 posts - 196 through 210 (of 445 total)