Viewing 15 posts - 121 through 135 (of 327 total)
Don't need the "Left" in the DATENAME part.
SELECT DATENAME(weekday, getdate()) as DAY,
convert(char(20), getdate(),9)+ ' ' +
Right(convert(varchar, getdate(),9),2) as [Date/Time]
DAY Date/Time
------------------------------ -----------------------
Tuesday May 31 2005 3:56:23 PM
May 31, 2005 at 2:12 pm
This seems to work:
SELECT DATENAME(weekday, LEFT (getdate(), 12)) as DAY,
convert(char(20), getdate(),9)+ ' ' + Right(convert(varchar, getdate(),9),2) as [Date/Time]
DAY Date/Time
------------------------------ -----------------------
Tuesday May 31 2005 3:40:03 PM
May 31, 2005 at 1:54 pm
Add this last part to get am/pm:
SELECT DATENAME(weekday, LEFT (getdate(), 12)) AS Day, LEFT (getdate(), 12) AS
Date, convert(varchar, getdate(),8) + Right(convert(varchar, getdate(),9),2) as [time]
Edit: But I guess that...
May 31, 2005 at 1:40 pm
This will get you the hh:mm:ss but not am/pm:
SELECT DATENAME(weekday, LEFT (getdate(), 12)) AS Day, LEFT (getdate(), 12) AS
Date, convert(varchar, getdate(),8) AS [time]
May 31, 2005 at 1:33 pm
In cases where the time portion really did not matter I have used datetime with a constraint to ensure all of the time values were zero. That way I retain...
May 31, 2005 at 11:13 am
I don't have any experience with custom types for dates but have in one instance been using datetime to store "just time" and its been working fine.
I have to ask...
May 31, 2005 at 8:32 am
I found this in the Database Developer's Companion (books NOT online):
If a subquery introduced with ALL and a comparison operator does not return any values, all rows in outer...
May 27, 2005 at 2:49 pm
This should give you a hint:
select Right('00' + cast(month(getdate()) as varchar),2)
----
05
May 27, 2005 at 12:57 pm
For lots of good information on working with sql server dates you can check out these two articles:
May 27, 2005 at 8:10 am
The alias "a" referenced in the WHERE clause is not valid as there is no table with that alias. "a' is only an alias within the definition of the derived...
May 26, 2005 at 9:37 pm
Bob,
By placing "@maxPunchID int" before the AS you created an input parameter to the stored procedure and as you discovered, were required to pass in a value for that...
May 26, 2005 at 9:04 pm
Display of all amounts where cents = .00
insert into #temp values (14.00)
select * from #temp
Where cast(amt as int) - amt = 0
amt
-------
14.00
(1 row(s) affected)
Edit:...
May 26, 2005 at 12:25 pm
Are you trying to return all rows where the cents part is .00 or are your trying to convert the display of all amount so that they show .00?
May 26, 2005 at 12:19 pm
I think this may be what your looking for:
create table #temp (amt decimal(5,2))
insert into #temp (amt) values (12.34)
select cast(cast(amt as int)as decimal (5,2) )
from #temp
-------
12.00
May 26, 2005 at 12:11 pm
Your welcome. The other way would be to use a correlated sub query.
Select ID, PathwayID
From YourTable as A
Where ID = (Select min(ID)
From YourTable
Where PathwayId = A.PathwayId)
Order...
May 26, 2005 at 10:42 am
Viewing 15 posts - 121 through 135 (of 327 total)