Viewing 15 posts - 3,661 through 3,675 (of 10,144 total)
It's not often that such a great example of when not to use cursors comes up. This appears to be a very straightforward query:
DECLARE @start DATETIME
SELECT @start = MAX(SessionEndDate) FROM...
February 6, 2014 at 2:07 am
Edit: completely misunderstood the question. Where's the coffee?
February 6, 2014 at 1:41 am
Can't you ask your boss?
The reason I'm asking is because - if (s)he isn't aware that your script can't be shaped into a view, (s)he probably isn't aware that...
February 5, 2014 at 7:04 am
dhananjay.nagarkar (2/4/2014)
I'm trying to do-If the "[Latest Filled Date]" equals the previous weeks Monday - Saturday dates...
February 5, 2014 at 6:55 am
crazy_new (2/5/2014)
Thanks for your help...
February 5, 2014 at 6:45 am
Another way:
,row_number() over (
partition by AD.UnitNumber,AD.AccountNumber order by AD.VisitID) as [Index]
,COUNT(*) over (partition by AD.UnitNumber,AD.AccountNumber) as [MaxIndex]
filter on [Index] = 1 OR [Index] = [MaxIndex]
February 5, 2014 at 6:42 am
What's going to consume the result set from the view? How will it handle an unknown number of columns with some unknown names? Can't you concatenate the variable address elements...
February 5, 2014 at 6:13 am
Nice work, Helmi. The best possible outcome here is when the OP - that's you - figures out the problem themselves given a few pointers.
You may wish to examine your...
February 5, 2014 at 4:57 am
The BETWEEN range ends at 'V'. If you have a vendor with exactly this value then it will be included. Vendors called 'V' + anything else will be excluded because...
February 5, 2014 at 2:23 am
Eliminating rows with a null value could play havoc with your [Status] values. Try this to see what I mean:
selectdistinct
ph.ProdHeaderOrdNr,
ph.PartCode,
ph.[Description],
ph.Qty,
[Status] = (
select max(psl.ProdStatusCode)
from ProdStatusLog psl
where psl.ProdHeaderDossierCode = ph.ProdHeaderDossierCode),
[Uitgifte] =...
February 4, 2014 at 7:31 am
Here's your query rewritten to replace old-style joins and with table aliases to reduce noise:
selectdistinct
ph.ProdHeaderOrdNr,
ph.PartCode,
ph.[Description],
ph.Qty,
[Status] = (
select max(psl.ProdStatusCode)
from ProdStatusLog psl
where psl.ProdHeaderDossierCode = ph.ProdHeaderDossierCode),
[Uitgifte] = (
select max(psl.LastUpdatedOn)
from ProdStatusLog psl
where psl.ProdHeaderDossierCode...
February 4, 2014 at 7:17 am
L' Eomot Inversé (2/4/2014)
Grant Fritchey (2/3/2014)
February 4, 2014 at 6:58 am
sql_ques (2/4/2014)
The datatype of column is ntext
Ouch! I remember those...
February 4, 2014 at 6:01 am
sql_ques (2/4/2014)
This worked 🙂REPLACE(CAST(ColumnName AS nvarchar(max)),';#','' )AS [Type]
What datatype is the input column? Remove the CAST, it's unnecessary overhead.
February 4, 2014 at 5:51 am
Here's a pure TSQL method to compare with Lowell's string-concatenation method.
;WITH Rates AS (SELECT worker_id, rate_code, rate_count = COUNT(*) OVER(PARTITION BY worker_id)
FROM #worker_rate r)
SELECT
rate_group = DENSE_RANK() OVER(ORDER BY...
February 3, 2014 at 9:18 am
Viewing 15 posts - 3,661 through 3,675 (of 10,144 total)