Viewing 15 posts - 1 through 15 (of 32 total)
To make sure first day of the week is Monday so you can assume that, to get the next Monday, just add 8 minus the current day of the week....
August 8, 2013 at 11:29 am
How about this?
set datefirst 1
declare @basedate as datetime
set @basedate = '20130808'
select
Today = @basedate,
NextMonday = dateadd(dd, 8-datepart(dw, @basedate), @basedate),
MondayAfterNext = dateadd(dd, 15-datepart(dw, @basedate), @basedate)
Happy Coding!!!
~~ CK
August 8, 2013 at 10:26 am
Try...Catch... is not a transaction controlling statement. It's more of an error handling in SQL Server. If you do not have a transaction block anywhere, every successful update will be...
August 7, 2013 at 2:40 pm
I agree.
I made the INSERT/EXEC recommendation with the assumption that the he does not have any control on the SP aside from executing it.
August 7, 2013 at 10:51 am
Couple of questions:
1. Will it always have, at most, 2 pair of record?
2. Will the resulting record have the period + 1 of the paired records? Will there be...
August 7, 2013 at 10:49 am
How about this?
declare @spWhoTable as table
(
col_spid int,
col_ecid int,
col_status varchar(20),
col_loginame varchar(20),
col_hostname varchar(20),
col_blk varchar(20),
...
August 6, 2013 at 9:13 pm
How about something with no CTE nor subquery...
I'll borrow the population of test data...
if OBJECT_ID('tempdb..#Something') is not null
drop table #Something
create table #Something
(
VendID char(3),
Type int
)
insert #Something
select 'ABC', 1 union all
select 'ABC',...
August 6, 2013 at 9:03 pm
How about this?
To change the number of batch, change the value of @batch variable.
declare @batch as smallint
set @batch = 6
if object_id('tempdb..#sample') is not null
drop table #sample
SELECT...
August 6, 2013 at 8:49 pm
I believe INFORMATION_SCHEMA views is already existing in sql 2000. You might be able to start from there.
Happy Coding!!!
~~ CK
April 27, 2010 at 10:33 am
SanjayAttray (10/29/2009)
Damn. I missed the increment/seed part. Generally we used (1,1) for identity column and its (1,3) in the question.
That hit me, too...:angry:
October 29, 2009 at 12:09 pm
Build a dynamic query for your BULK INSERT
exec ('BULK INSERT slave_tab
FROM ''' + @YourFileName + '''
WITH
( FIELDTERMINATOR =''^'',
...
October 30, 2008 at 2:45 am
Could you post too 10 rows from each table and your desired results?
-- CK
October 24, 2008 at 1:15 pm
Would JOIN not be enough?
-- CK
October 24, 2008 at 10:10 am
October 24, 2008 at 10:08 am
October 24, 2008 at 3:22 am
Viewing 15 posts - 1 through 15 (of 32 total)