Viewing 15 posts - 1 through 15 (of 276 total)
Something like this should work.
DECLARE @date DATETIME
SET @date = GETDATE()
SELECT @date
SELECT DATEADD(dd, DATEDIFF(dd, 0, DATEADD(DD, 1 - DAY(@date), @date)), 0)
March 18, 2011 at 8:47 am
What your desired output is for any date given, give the first day of the month @ midnight, correct?
March 18, 2011 at 8:43 am
To get rid of the extra work of the case and sum, another option:
SELECT COUNT(Student_ID)
, Grade_Description
FROM Student s
...
February 10, 2011 at 1:51 pm
1. SET @ColName=" Function which will return the Column name"
2. Select @Result='Select ' + @Colname + ' from <my Table>'
November 24, 2010 at 11:13 am
I am only extending the result set to match what the op requested...
DECLARE @Today DATETIME
, @nMonths TINYINT
SET @Today = GETDATE()
SET @nMonths = 12
SELECT MonthEndDate = DATEADD(dd, -1,...
November 24, 2010 at 7:23 am
similar result, with out the replace function
DECLARE @text VARCHAR(250)
SET @text = 'Login succeeded for user ''domain\user''. Connection made using Windows authentication. [CLIENT: xxx.xxx.xxx.xxx]'
SELECT SUBSTRING(@text, CHARINDEX('''', @text) + 1, CHARINDEX('''', @text,...
November 10, 2010 at 1:53 pm
Craig Farrell (11/9/2010)
November 9, 2010 at 11:52 am
Please present some data so that a tested solution can be presented.
I'll even help (again) get you started.
SELECT '12-15 Hardley Street'
UNION ALL
SELECT '2A-C Hardley Street'
UNION ALL
SELECT...
October 21, 2010 at 7:56 am
I am not sure what in the requirements have changed. Can you please provide data in a consumable format, and the desired output for that data.
Also, you state SSIS...
October 20, 2010 at 11:22 am
cmrhema (10/19/2010)
I have a column named Address in a table.
I have values such as
12-15 Hardley Street
2A-C Hardley Street
A-2c Hardley Street
A-B Hardley Street
I am required to keep the hyphen(-) intact in...
October 19, 2010 at 10:41 am
Tools -> Options
Text Editor
-> Editior Tab and Status Bar
-->Tab Text
----> Include DatabaseName False
----> Include FileName True
----> Include Login Name False
----> Include Server Name True
Or, whatever options you want. I...
October 11, 2010 at 9:57 am
sharonmtowler (10/4/2010)
i tried this
cast(( dbo.INVHDRPF.ININVY * 10000) + (dbo.INVHDRPF.ININVM* 100) + dbo.INVHDRPF.ININVY as datetime)
these were my results
YEAR MONTH DAY...
October 4, 2010 at 9:09 am
There may be other ways, but here is one way:
DECLARE @m INT
DECLARE @d INT
DECLARE @y INT
SET @y = 2010
SET @d = 4
SET @m = 10
SELECT CAST(CAST(@y...
October 4, 2010 at 8:12 am
Oh wow- this is 4 years old...I do not remember what was the issue. As a point of interest, some time after this post, I converted all backups to...
October 1, 2010 at 12:20 pm
Viewing 15 posts - 1 through 15 (of 276 total)