[Msg]: FW: 'Nested' Case statements (12/3/2004)
***********************
Your mail has been scanned by Interscan
***********-***********
Incase anyone is interested or has comments I ended doing it like
this....
select case Datepart...
[Msg]: Re: 'Nested' Case statements (12/3/2004)
I think can do this without the CASE statement using things like SELECT left(DATENAME(dw, getdate()),3).
Also check the other 'Date and Time Functions' in BOL.
HTH
cheers,
Paul.
----- Ori...
[Msg]: RE: 'Nested' Case statements (12/6/2004)
If you used datename(dw, days) then you would get back Sunday, Monday, etc.
Sharon
_____
From: bounce-sql2k-6864927@ls.sswug.org
[mailto:bounce-sql2k-6864927@ls.sswug.org] On Behalf...
[Msg]: RE: 'Nested' Case statements (12/3/2004)
How about...
select left(datename(dw,getdate()),3) + ' ' +
right('0'+ltrim(str(datepart(d,getdate()))),2)
_____
From: bounce-sql2k-8626898@ls.sswug.org
[mailto:bounce-sql2k-86...
[Msg]: Rounding off to the nearest quarter hour (11/26/2004)
***********************
Your mail has been scanned by Interscan
***********-***********
Hi
I have a script that allows me to round of to the nearest quarter hour,
see below, just wonderin...
[Msg]: [SQL2K] query help (11/27/2006)
I wrote a simple create view script the unions data from other databases
and it's giving me the error: Any idea how to modify this script?
--'CREATE VIEW' does not allow specifying the datab...
[Msg]: RE: [SQL2K] query help (11/27/2006)
I believe you should use aggregate function in your select statement...
select 'CUSTOMER RELATIONSHIP MANAGEMENT' service, bg_subject,
max(datepart(month, bg_detection_date)) 'TEST ...
[Msg]: RE: Date Part (8/27/2003)
You have DATEPART mixed up. For dmonth you are using day, for dweek you
using month and for dweek you are using month.
try using:
update severityreport
set dyear = datepart(year,cprundate),
...
[Msg]: RE: Date Part (8/27/2003)
You have DATEPART mixed up. For dmonth you are using day, for dweek you
using month and for dweek you are using month.
try using:
update severityreport
set dyear = datepart(year,cprundate),
...
[Msg]: Re: Rounding off to the nearest quarter hour (11/26/2004)
Dunno if this is less messy, but here's a way building on 'simple'
string concatenation
-- string based concetantion
select convert(char(17), getdate(), 120) +
case
when right(convert(cha...
[Msg]: [SQL2K] query help (11/28/2006)
Great. Will do. Thanks Mohammed.
Ammie
________________________________
From: listbounces@sswug.org [mailto:listbounces@sswug.org] On Behalf Of
Mohammed Uddin
Sent: Monday, N...
[Msg]: RE: Inserting into a table (3/3/2005)
Try this:
create table tblyeardates (datecol datetime)
declare @time datetime,
@end datetime
set @time = case when datepart(dw,getdate()) = 2 then getdate()-1
...
[Msg]: [sswug:sql2k] stored procedure help (6/6/2002)
I am trying to write a stored procedure that will drop a database on the
last day of the month.
I already verified that the SQL Server job scheduler has the ability to
schedule jobs to run jobs
...
[Msg]: Re: [sswug:sql2k] stored procedure help (6/6/2002)
@stmt = 'drop database ' + @dbname
sp_executesql @stmt
G. Waleed Kavalec
-------------------
Quidquid latine dictum sit, altum sonatur.
----- Original Message -----
From:
To:
...
[Msg]: RE: [sswug:sql2k] stored procedure help (6/6/2002)
I believe you'll need dynamic SQL to do this...
i.e.
DECLARE @Str varchar(200)
Set @Str = 'drop database ' + @dbname
exec (@Str)
Also -- You could replace the case statement with
Select ...
[Msg]: RE: [sswug:sql2k] stored procedure help (6/6/2002)
try
Select @dbname = 'exec drop database REPORT_'+@month+'_'+@year
exec (@dbname)
-----Original Message-----
From: henry.maan_de_kok@kemperinsurance.com
[mailto:henry.maan_de_kok@kemperinsura...