Viewing 15 posts - 211 through 225 (of 398 total)
check system function datepart in BOL.
select datepart(dw, getdate())
returns today's weekday.
April 7, 2004 at 10:53 pm
information_schema.columns is one you needed.
if exists(select * from information_schema.columns where Table_name='YourTable' and column_name = 'YourColumn')
print 'add column'
else
print 'exists'
April 7, 2004 at 10:48 pm
SELECT CODE, SUM(C1) AS '04/01/2004', SUM(C2) AS '04/02/2004', SUM(C3) AS '04/05/2004', SUM(C4) AS '04/06/2004', SUM(C5) AS 'TOTAL'
FROM
(SELECT CODE,
SUM(CASE WHEN stdate BETWEEN '04/01/2004'AND '04/01/2004' THEN qty ELSE 0 END) AS C1,
SUM(CASE...
April 7, 2004 at 10:31 pm
If stored procedure uses UDD in dynamic fashion, sp_droptype would not be affected.
Otherwise it always ends up in table column, that mentioned method can be used.
April 6, 2004 at 8:57 am
It is normalization vs. denormalization issue.
April 6, 2004 at 8:08 am
if not exists(select object_id('tempdb..#temp_work'))
print 'create temp table'
else
print 'exists'
April 6, 2004 at 7:52 am
alter table alter column to normal datatype.
sp_droptype
sp_addtype
alter table column back to udd
You can get table, column list from
select table_name, COLUMN_NAME from information_schema.column_domain_usage
where DOMAIN_NAME = 'UDD'
or
update systypes table directly (not...
April 6, 2004 at 6:21 am
It is the column position.
Here is the sample.
use pubs
go
create table test (c1 int, c2 int, c3 varchar(2), c4 int, c5 int)
grant select (c3, c5) on test to guest
select id, uid,...
April 6, 2004 at 3:23 am
SELECT CODE, SUM(C1) AS '04/01/2004', SUM(C2) AS '04/02/2004', SUM(C3) AS '04/03/2004', SUM(TOTAL) AS 'TOTAL'
FROM
(SELECT CODE,
SUM(CASE WHEN stdate BETWEEN '04/01/2004'AND '04/01/2004' THEN qty ELSE 0 END) AS C1,
SUM(CASE WHEN stdate BETWEEN...
April 5, 2004 at 6:25 pm
bcp data out, then bcp into temptable using -F, -L parameters.
April 5, 2004 at 9:08 am
separate group by, sum and order by from data extraction will help.
April 5, 2004 at 8:53 am
update column value instead.
Here is sample case.
use pubs
go
create table uppercase (c1 varchar(100))
go
create trigger trg_uppercase on uppercase
instead of insert
as
begin
insert uppercase select upper(c1) from inserted
end
go
insert uppercase values('qwe32Rt')
go
select * from uppercase
go
drop trigger...
April 5, 2004 at 8:33 am
SELECT findings, packingdets from
(SELECT findings, packingdets, SV_CASEREF FROM RECEIVEGOODS
UNION
SELECT findings, packingdets, SV_CASEREF FROM RECEIVEGOODS_V1) a WHERE SV_CASEREF = 'P4476#70211'
April 2, 2004 at 8:15 am
Viewing 15 posts - 211 through 225 (of 398 total)