Viewing 15 posts - 7,831 through 7,845 (of 8,731 total)
What's wrong with a simple CAST or CONVERT?
SELECT CONVERT( datetime, 'Jul 24 2013 8:05AM')
July 30, 2013 at 9:08 am
I'm not sure I'm getting this correct, but based on your description, this is my guess.
There are some errors on the code, I changed to what seemed correct.
--Look for these...
July 29, 2013 at 1:33 pm
You could use NULLIF(DeptCount, 0)
EDIT: Add reference http://msdn.microsoft.com/en-us/library/ms177562%28v=sql.90%29.aspx
July 29, 2013 at 1:16 pm
July 29, 2013 at 12:45 pm
What about a simple DATEADD(wk, -1, GETDATE()) and change the value to bee substracted?
Or use DATEADD(wk, -6, GETDATE()) AND DATENAME(dw, date_needed) = 'Tuesday'?
It's an idea. You could also use DATEPART.
July 29, 2013 at 12:00 pm
No, it won't. Unless they add 3 new months to the calendar.:-D
July 26, 2013 at 11:42 am
You don't have any variables in your code.
You can check the CREATE FUNCTION syntax in here http://msdn.microsoft.com/es-es/library/ms186755%28v=sql.90%29.aspx
CREATE FUNCTION dbo.Example_function_name
(
@Parameter1 int
)
RETURNS TABLE
...
July 26, 2013 at 11:03 am
Thank you for the reference Lowell, I knew I had read it, but I wasn't sure where to start looking for it again.
July 26, 2013 at 10:28 am
First of all, you can't add a milisecond to a datetime, you need to use datetime2.
Here's an example, if you remove the CAST, you'll see what I mean.
SELECT TOP (500)...
July 26, 2013 at 10:12 am
Let's get some coffee before we answer in the morning 🙂
July 26, 2013 at 8:43 am
I'm glad I could help.
Thank you for the feedback.;-)
July 26, 2013 at 8:11 am
The problem with MIN(DateFoBirth) is that is getting the oldest person, not the youngest. :hehe:
July 26, 2013 at 7:56 am
This works for me.
SELECT ID,
CASE WHEN Category IN( 'Art', 'PE') THEN 'Non Educational' ELSE Category END Category,
DATEADD( dd, -1, DATEADD(wk, DATEDIFF(wk,0,Date), 0)) Week,
SUM(Hours) Total_Hours
FROM Attendance
GROUP BY ID,
CASE WHEN Category...
July 25, 2013 at 6:05 pm
I misread a part of your original post and became more clear now.
You could use DATEADD(wk, DATEDIFF(wk,0,Date), 0) to get the first day of the week and be able to...
July 25, 2013 at 5:18 pm
Eric M Russell (7/25/2013)
Luis Cazares (7/25/2013)
How about this?
SELECT TOP 1 *
FROM MyTable
ORDER BY DateOfBirth DESC
We also can't assume that DateOfBirth isn't nullable.
SELECT TOP 1 *
FROM MyTable
WHERE DateOfBirth is not null
ORDER...
July 25, 2013 at 5:15 pm
Viewing 15 posts - 7,831 through 7,845 (of 8,731 total)