Viewing 15 posts - 76 through 90 (of 327 total)
The concept of row order just does not exist in sql server. Chris is correct! Under the circumstances you describe there is just no way you can reliably determine the order...
June 12, 2005 at 3:15 pm
I think Frank pretty much gave you everything you need to work this out. Anyway...
Select t1.*, t3.status_description
From t1
Join t2
on t2.DataId = t1.DataId
And t2.StatusChangeDate =
(Select Max(StatusChangeDate)
From...
June 11, 2005 at 9:39 pm
This may be what you are looking for:
Select convert(char(10),getdate(),110) [current_date],
datediff(ww,dateadd(M, datediff(M, 0, getdate()), 0),getdate()) + 1 as [week_number]
current_date week_number
------------ -----------
06-10-2005 2
This code gets the number of...
June 10, 2005 at 9:11 pm
BTW, I do know how to view the query plan but how do you get that in text format?
June 10, 2005 at 1:23 pm
Not exactly. That produces the format yyyymmdd. My statement (several posts above) produces the format yyyyddmm.
June 9, 2005 at 8:14 pm
I also prefer to use convert but the example given by the original poster is ambiguous and I thought they were looking for a format of YYYYDDMM which I don't...
June 9, 2005 at 4:28 pm
Select Distinct version,
(Select isnull(sum(vcount),0)
from @datatable
where datadate = @week3
and version = dt.version) week3,
(Select isnull(sum(vcount),0)
from @datatable
where datadate = @week2
and version = dt.version)...
June 9, 2005 at 12:05 pm
Working from your first post:
Select dt.Version, sum(dt.vcount)
From @DataTable dt
Where datadate IN
(Select top 4 datadate
From @datatable
Where version = dt.version
Order by datadate desc)
Group By dt.version
Order By dt.version
June 9, 2005 at 11:05 am
Create a bit flag for each column that may need to be updated and use an update statement similar to this:
update YourTable
set col1 =
case
when(@col1_change=1) then @new_col1_val
else col1
end,
col2 = ...
June 9, 2005 at 10:28 am
If you're looking for the format to be yyyyddmm
select cast(datepart(yy,getdate()) as varchar) +
Right ('00' + cast(datepart(dd,getdate())as varchar),2) +
Right ('00' + cast(datepart(mm,getdate()) as varchar),2)
----------------------------------
20050906
Edit:...
June 9, 2005 at 9:50 am
I had an idea you were enumerating something but I wasn't quite sure what was going on. Also I was confused by this syntax set @Int = Colid2 =...
June 8, 2005 at 7:32 pm
Viewing 15 posts - 76 through 90 (of 327 total)