Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)

  • RE: Declare variable as column

    Yes exactly. But what happens if you use a WHERE clause there? it says that the column doesnt exist, that is my problem..

     

    select customerId,

           'Customers' as 'origin'

    from   customers

    union all

    select customerId,

           'Orders'

    from ...

  • RE: Declare variable as column

    I have four tables with im joining with a UNION ALL, and dynamically adding a column which unique identifies the four tables.. like this resultset:

    COL1, COL2, COL3, ThisDoesntExist

    VAL1   VAL2   VAL3  ...

  • RE: parameter in four-partname tables

    the reason? a large system which was badly developed at the beginning years ago and no corporate money or time to rebuild it the right way...

  • RE: parameter in four-partname tables

    Thanks David.

    ' + @table + ' was exactly was i was looking for

  • RE: parameter in four-partname tables

    The data needs to be separated im afraid, so im querying different tables.

    Thats why I want one SP which are general for all tables (which have same structure), instead of...

  • RE: parameter in four-partname tables

    Here is the SP:

    CREATE PROCEDURE sp_inventering_lista

    @RESENH varchar(255)

    AS

    SELECT

     subquery.Resultatenhet,

     subquery.ARTNR,

     subquery.BENAEMN,

     subquery.ILAGER,

     subquery.RESANT,

     subquery.DISPONIBELT,

     SUM(subquery.SALDO)+DISPONIBELT AS SALDO,

     SUM(subquery.SALDO)+SUM(inventering.dbo.hagfors.antal) as SALDO_INVENTERING

    FROM

     (SELECT

      CASE dbo.ARTRAD.RESENH

       WHEN 'Ar' THEN 'Arvika'

       WHEN 'Ha' THEN 'Hagfors'

       WHEN 'Kd' THEN 'Karlstad'

       WHEN 'Su' THEN 'Sunne'

       WHEN 'To' THEN 'Torsby'

      END AS...

  • RE: parameter in four-partname tables

    Thanks, this helped me.

    I tried to keep the code minimal, but it seems like its not really possible when doing this.

    Btw, It's on a closed intranet server and this is...

  • RE: Run DTS from ASP

    Because I want to be able to handle the steps and data in realtime, I'f i'd been using SP i would just get the results - when using the DTS.Package...

  • RE: Run DTS from ASP

    Oh and by the way, I don't want to use XP_CMDSHELL (the dtsrun command) - that works fine, but I want to have more realtime control of the output, speed is...

Viewing 9 posts - 1 through 9 (of 9 total)