Forum Replies Created

Viewing 15 posts - 1,186 through 1,200 (of 2,171 total)

  • RE: Converting a query with *= to ansi conform join operators

    Try thisselectma.ma_idx,

    ma.ma_kurztext_deu,

    kd.kd_preis,

    kl.kd_preis

    fromdebitor as db

    inner joinkondition as kd on kd.kd_pl_idx = db.db_ko_vkpreis

    and kd.kd_vkorg = db.db_vkorg

    inner joinmaterial as ma on ma.ma_idx = kd.kd_ma_idx

    left joinkondition as kl on kl.kd_pl_idx = {table alias here}.db_ko_ldpreis

    and...

  • RE: Want to Calculate Business Working hours

    I think there already are about 15 zillion postings about this exact problem.

    Try to search this forum for similar requests and see what you get?

  • RE: Converting a query with *= to ansi conform join operators

    Before we can suggest anything at all, you need to prefix ALL columns with proper table name or table alias.

  • RE: A very complicated date query

    SELECTe.PatientID,

    e.Qtr,

    AVG(e.Days) AS avgLos

    FROM(

    SELECTm.PatientID,

    m.ClinicUnit,

    d.Qtr,

    COUNT(*) AS Days

    FROMMaster AS m

    CROSS APPLY(

    SELECTx.Date,

    x.Qtr

    FROMDates AS x

    WHEREx.Date BETWEEN m.StartDate AND m.EndDate

    ) AS d

    GROUP BYm.PatientID,

    m.ClinicUnit,

    d.Qtr

    ) AS e

    GROUP BYe.PatientID,

    e.Qtr

  • RE: A very complicated date query

    Something similar to thisSELECTm.PatientID,

    m.ClinicUnit,

    d.Qtr,

    COUNT(*) AS Days

    FROMMaster AS m

    CROSS APPLY(

    SELECTd.Date,

    d.Qtr

    FROMDates AS d

    WHEREd.Date BETWEEN m.StartDate AND m.EndDate

    ) AS d

    GROUP BYm.PatientID,

    m.ClinicUnit,

    d.Qtr

  • RE: SQL 2005 max variable size 4k

    MarkusB (11/7/2007)


    Peter Larsson (11/7/2007)


    NVARCHAR is still 4000 bytes due to being double byte character sting (unicode).

    Sorry Peter to correct you but nvarchar too is 8000 bytes, but the length is...

  • RE: Help with extracting Bits out of Binary Number

    DECLARE@HEX BINARY(4)

    SET@HEX = 0x00280000

    SELECT(CAST(@HEX AS BIGINT) / POWER(2, 18)) & 0x1f

  • RE: SQL 2005 max variable size 4k

    NVARCHAR is still 4000 bytes due to being double byte character sting (unicode).

  • RE: how to remove numbers from strings?

    That's 381.25 billion records in the table with an insert rate of 5800 records per second.

  • RE: Variable Not Setting

    If this line of code do not return a record

    SELECT @tmp = [Code] FROM LookupTable WHERE [Code] = @tmp

    no variable is set! Not even to NULL. It is untouched.

  • RE: T-SQL

    Or a SQL Server 2005 solution?

    select*

    from(

    SELECTbooks.*,

    count(*) over (partition by books.bk_no) AS items

    FROMbooks

    INNER JOINordered_items ON ordered_items.bk_no = books.bk_no

    ) as d

    whereitems > 1

  • RE: Tale of <> Operator

    CREATE TABLE#Sample

    (

    RowID INT IDENTITY(1, 1) PRIMARY KEY CLUSTERED,

    theValue TINYINT

    )

    INSERT#Sample

    SELECTABS(CHECKSUM(NEWID())) % 3

    FROMsyscolumns AS c1

    CROSS JOINsyscolumns AS c2

    CREATE INDEX IX_Peso ON #Sample (theValue)

    SELECTtheValue

    FROM#Sample

    WHEREtheValue = 1

    /*

    |--Index Seek(OBJECT: ([tempdb].[dbo].[#Sample]), SEEK: ([tempdb].[dbo].[#Sample].[theValue]=(1)) ORDERED...

  • RE: Join Help

    SELECTCOUNT(DISTINCT lb.po_id)

    FROMORDER_PO AS p

    LEFT JOINORDER_SALES AS os ON os.Req_no = p.Po_id

    AND os.Active = 1

    LEFT JOINLIST_BASES AS lb ON lb.Base_id = p.Base_id

    WHEREp.Requisition = 1

  • RE: Need some help troubleshooting my first email alert trigger

    SELECT @Commission = min(select commission_cost)

    FROM oe_line

    WHERE order_no = @OrderNo

Viewing 15 posts - 1,186 through 1,200 (of 2,171 total)