Viewing 9 posts - 1 through 9 (of 9 total)
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 ...
September 9, 2005 at 8:38 am
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 ...
September 9, 2005 at 6:51 am
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...
September 1, 2005 at 9:57 am
Thanks David.
' + @table + ' was exactly was i was looking for
September 1, 2005 at 9:54 am
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...
September 1, 2005 at 2:43 am
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...
August 31, 2005 at 6:00 pm
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...
August 31, 2005 at 12:38 pm
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...
August 22, 2005 at 7:04 am
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...
August 22, 2005 at 3:26 am
Viewing 9 posts - 1 through 9 (of 9 total)