Forum Replies Created

Viewing 15 posts - 211 through 225 (of 398 total)

  • RE: Date issue

    check system function datepart in BOL.

    select datepart(dw, getdate())

    returns today's weekday.

  • RE: Select with no headers

    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'

  • RE: Cross tab

    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...

  • RE: Modifying UDD Length

    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.

  • RE: Serveral nullable columns in a table

    It is normalization vs. denormalization issue.

  • RE: HOT TIP on posting!!!!!!!

    Good one!

    How did you find it out?

  • RE: some duh help please

    if not exists(select object_id('tempdb..#temp_work'))

      print 'create temp table'

    else

      print 'exists'

  • RE: Modifying UDD Length

    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...

  • RE: Sysprotects.columns field

    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,...

  • RE: Cross tab

    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...

  • RE: Find a specific Row by the Row Number

    bcp data out, then bcp into temptable using -F, -L parameters.

  • RE: A query with too many joints...

    separate group by, sum and order by from data extraction will help.

  • RE: Noob QOD (uppercase)

    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...

  • RE: Syntax Problem using UNION

    table alias

  • RE: Syntax Problem using UNION

    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'

Viewing 15 posts - 211 through 225 (of 398 total)