Viewing 15 posts - 601 through 615 (of 897 total)
You can write a CASE statement and return the greatest among the First Date Of The Month and the First Date Of The Week
DECLARE@from_date DATETIME
SET@from_date = '02-Sep-2011'
SELECTCASE
WHEN DATEADD( MONTH, DATEDIFF(...
September 27, 2011 at 10:17 pm
Jeff Moden (7/22/2011)
Sugsy (7/22/2011)
Just for the record Kingston's suggestion works fine n'all
Just for the record, it will also delete the wrong data if the right 3 occurs more than once...
July 24, 2011 at 10:13 pm
hxkresl (6/30/2011)
July 1, 2011 at 12:54 am
Thanks for the replies folks. I will check the ARITHABORT and the ANSI WARNINGS option along with the connection settings.
May 12, 2011 at 1:16 am
I don't have much idea about the connection settings.
But i remember in my previous case, a query in a derived table was returning a zero value for a particular column...
May 11, 2011 at 6:35 am
You can create a single trigger for all three operations( INSERT, UPDATE and DELETE )
Inside the trigger you will have write programming logic to INSERT values in Status table based...
February 23, 2011 at 10:23 pm
A trigger would be better as that would also help you to track if somebody has inserted, updated or deleted an Order from outside your C# Application.
February 22, 2011 at 10:06 pm
barakos (2/14/2011)
HI.I want to ask if there's a way to call a function with the argument "table name" (string),
and the function will return a variable of type Table?
Thanks.
I think...
February 14, 2011 at 2:09 am
crazekalyan (1/17/2011)
ThanKs, it worked.
Did you test if the results are correct? Adding a TOP 1 query would avoid the error but will most probably give you incorrect results. Please provide...
January 17, 2011 at 9:28 pm
This should help you out
DECLARE @tbl_Table1 TABLE
(
Sequence_id INT,
idINT,
NameVARCHAR(100),
[Key]INT,
item_nameVARCHAR(100),
rule_idINT
)
DECLARE@tbl_Table2 TABLE
(
rule_id INT,
Name VARCHAR(100)
)
INSERT INTO @tbl_Table1 VALUES( 1, 6761, 'Includes', 0, NULL, NULL )
INSERT INTO @tbl_Table1 VALUES( 2, 6761, 'item', 160, 'abc', NULL...
December 31, 2010 at 3:53 am
This will give you the desired information
SELECTJ.name, J.description, JS.step_name, JS.database_name
FROMmsdb.dbo.sysjobs J
INNER JOIN msdb.dbo.sysjobsteps JS ON J.job_id = JS.job_id
WHEREJS.database_name IN ( 'database1', 'database2' ) -- List your databases here
December 28, 2010 at 5:11 am
New Commer (12/28/2010)
Yes Kingston it does work...
When i run the code with a date of 15-January-2010, I get the CurrentYearBeginDate as 01-April-2010. Should it not be 01-April-2009?
December 28, 2010 at 2:23 am
New Commer (12/28/2010)
Abhijeet Chavan (12/28/2010)
DECLARE @CYBeginDate smalldatetime, @CYEndDate smalldatetime,
@LYBeginDate smalldatetime, @LYEndDate smalldatetime
select @CYBeginDate = dateadd(year, datepart(year, getdate()) - 1900, '1900-04-01')
select @CYEndDate = dateadd(day, -1, dateadd(month, 12, @CYBeginDate))
select @LYBeginDate...
December 28, 2010 at 12:45 am
New Commer (12/27/2010)
DECLARE @CYBeginDate VARCHAR(10)DECLARE @CYEndDate VARCHAR(10)
DECLARE @LYBeginDate VARCHAR(10)
DECLARE @LYEndDate VARCHAR(10)
DECLARE @CYDate DATETIME
DECLARE @LYDate DATETIME
SET @CYDate = GETDATE()
--Test Data
SET @CYDate = (Select Case When MONTH(GETDATE()) between...
December 28, 2010 at 12:38 am
New Commer (12/27/2010)
Actually the query willo be run at any time and it has to take care by itself to result with the current yr data...
December 27, 2010 at 8:32 am
Viewing 15 posts - 601 through 615 (of 897 total)