Viewing 15 posts - 166 through 180 (of 907 total)
Not really sure you even need to use the quarter table, provided you have normal quarter boundaries. If you have normal boundaries then I might use something like this...
September 17, 2003 at 8:32 am
One thing worth considering when deciding whether to run your package via a SQL Agent job, or via xp_cmdshell is timing of when the sp executes the statement after staring...
September 17, 2003 at 7:58 am
Sorry, I made that calculation do a lot more work then it needed to. Here is one with less math:
select convert(char(10),
dateadd(day,cast(substring(@jdate,5,7) as int)-1,cast(substring(@jdate,1,4) + '-01-01' as datetime))
, 101)
Gregory Larsen,...
September 16, 2003 at 3:00 pm
Try something like this:
declare @jdate char(7)
set @jdate = '2003226'
select convert(char(10),dateadd(day,1,datediff(day,1,substring(@jdate,1,4) + '-01-01')+
datediff(day,1,cast(substring(@jdate,5,7) as int))), 101)
Gregory Larsen, DBA
If you looking for SQL Server...
September 16, 2003 at 2:52 pm
Here I put the code into an SP (see below).
Place this command in a sql server agent job step:
osql -E -S<yourserver> -Q"dba.dbo.usp_get_dbinfo" -oc:\\temp\dbinfo.txt
CREATE PROCEDURE usp_get_dbinfo
AS
/*******************************************************************/
--Name ...
September 11, 2003 at 8:39 am
You can also use scptxfr.exe to script. This can be found in the upgrade directory. If you want to do it via t-sql then execute this via xp_cmdshell.
c:\mssql\upgrade\scptxfr.exe...
September 11, 2003 at 8:15 am
Here is a couple of articles that might help regarding collation and changing the collation settings.
http://www.sqlservercentral.com/columnists/glarsen/collate_part1.asp
http://www.sqlservercentral.com/columnists/glarsen/collate_part2_1.asp
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
September 10, 2003 at 5:29 pm
Interesting way to do that with a temporary SP. Here is another way using sp_executesql:
Declare @tablename sysname
declare @tablecount int
declare @strsql nvarchar(4000)
set @tablename = 'pubs.dbo.authors'
set @strsql = 'select @tablecount=count(*) from...
September 10, 2003 at 2:52 pm
one note. If you just alter a sp then the schema_ver number is incremented in the sysobjects table. If you knew the schema_ver number for all object prior...
September 9, 2003 at 9:57 am
Try something like this:
set nocount on
go
create table tableA (
col1char(5) not null,
col2int not null,
col3smallint not null,
col4char(80),
col5char(20),
constraint pk_tableA primary key nonclustered (col1, col2, col3))
go
create table sp_out (
TABLE_QUALIFIER varchar(128),
TABLE_OWNER varchar(128), ...
September 8, 2003 at 2:50 pm
You might try something like this
update indate_count
set MonthEndInd = 'z'
where in_date in (select max(in_date) from indate_count
group by datepart(yy,in_date),datepart(mm,in_date))
Gregory Larsen, DBA
If you looking for SQL Server Examples check out...
September 8, 2003 at 11:29 am
You might run into problems if you have different collation setting between SQL Server 2000 and 7.0. This normally happens when doing cross-database joins/compares. Basically the SQL 7.0 collation is...
September 4, 2003 at 2:41 pm
You can also add an identity column to the table to help with deleting duplicates. Here is an example of some code to do that:
alter table dup_table
...
September 3, 2003 at 9:28 am
Possibly something here might work for you:
set nocount on
declare @test-2 table (studentid int, specialcodeid int, specialcodevalue varchar(100))
insert into @test-2 values (111 ,10 ,'abc')
insert into @test-2 values (111 ,11 ,'5')
insert into...
September 2, 2003 at 2:13 pm
leitera - Good way to remove those duplicate rows first before comparing the two tables. Although there still are issues with the union option. Here table B has...
September 2, 2003 at 8:36 am
Viewing 15 posts - 166 through 180 (of 907 total)