Wednesday, March 28, 2012

saving output from multiple queries

Greetings,
I have what seems a simple problem...
I want to save the output from the following queries in 1 file in
'SQL Query Analyser', but I can only save each 'grid' separately.
I have about 30 queries in total. 'Messages' tells me the number of
rows affected but I need the data.
So can I save all the grids together at the same time in 1 file ?
Thanks
Mike
PRINT 'HEAT 3510'
SELECT f.persfirstname AS First_Name,
f.perslastname AS Last_Name,
a.rsrchqnumber AS Personal_nr,
b.asgtassignmentid AS Contract_nr,
ISNULL(c.tishcode,'') AS TS_Id,
ISNULL(d.tpitpayrollcode,'6900') AS Pay_Code,
d.tpitdaydate AS Payroll_Date,
c.tishactualenddate AS TS_end_date
FROM resources a
INNER join assignments b ON b.asgtrsrcguid = a.rsrcguid
INNER join timesheets c ON c.tishasgtguid = b.asgtguid
INNER join users e ON e.userguid = a.rsrcuserguid
INNER join persons f ON e.userpersguid = f.persguid
LEFT OUTER join timesheetpayrollitems d ON d.tpittishguid =c.tishguid
WHERE a.rsrchqnumber = 80000147
and b.asgtassignmentid = 0000001234
and c.tishactualenddate > '20050614'
and (d.tpitdaydate > '20050614'
or d.tpitdaydate IS null)
order by d.tpitdaydate
SELECT f.persfirstname AS First_Name,
f.perslastname AS Last_Name,
a.rsrchqnumber AS Personal_nr,
b.asgtassignmentid AS Contract_nr,
ISNULL(c.tishcode,'') AS TS_Id,
c.tishactualenddate AS TS_end_date,
g.thisdaydate AS TSH_date
FROM resources a
INNER join assignments b ON b.asgtrsrcguid = a.rsrcguid
INNER join timesheets c ON c.tishasgtguid = b.asgtguid
INNER join users e ON e.userguid = a.rsrcuserguid
INNER join persons f ON e.userpersguid = f.persguid
INNER join timesheethistory g ON g.thistishguid = c.tishguid
WHERE a.rsrchqnumber = 80000147
and b.asgtassignmentid = 0000001234
and c.tishactualenddate > '20050619'
order by g.thisdaydate
PRINT 'HEAT 3213'
Hi
1) DTS
2) BCP
<michaelnewport@.yahoo.com> wrote in message
news:1126768676.888961.311210@.g14g2000cwa.googlegr oups.com...
> Greetings,
> I have what seems a simple problem...
> I want to save the output from the following queries in 1 file in
> 'SQL Query Analyser', but I can only save each 'grid' separately.
> I have about 30 queries in total. 'Messages' tells me the number of
> rows affected but I need the data.
> So can I save all the grids together at the same time in 1 file ?
> Thanks
> Mike
> PRINT 'HEAT 3510'
> SELECT f.persfirstname AS First_Name,
> f.perslastname AS Last_Name,
> a.rsrchqnumber AS Personal_nr,
> b.asgtassignmentid AS Contract_nr,
> ISNULL(c.tishcode,'') AS TS_Id,
> ISNULL(d.tpitpayrollcode,'6900') AS Pay_Code,
> d.tpitdaydate AS Payroll_Date,
> c.tishactualenddate AS TS_end_date
> FROM resources a
> INNER join assignments b ON b.asgtrsrcguid = a.rsrcguid
> INNER join timesheets c ON c.tishasgtguid = b.asgtguid
> INNER join users e ON e.userguid = a.rsrcuserguid
> INNER join persons f ON e.userpersguid = f.persguid
> LEFT OUTER join timesheetpayrollitems d ON d.tpittishguid =c.tishguid
> WHERE a.rsrchqnumber = 80000147
> and b.asgtassignmentid = 0000001234
> and c.tishactualenddate > '20050614'
> and (d.tpitdaydate > '20050614'
> or d.tpitdaydate IS null)
> order by d.tpitdaydate
> SELECT f.persfirstname AS First_Name,
> f.perslastname AS Last_Name,
> a.rsrchqnumber AS Personal_nr,
> b.asgtassignmentid AS Contract_nr,
> ISNULL(c.tishcode,'') AS TS_Id,
> c.tishactualenddate AS TS_end_date,
> g.thisdaydate AS TSH_date
> FROM resources a
> INNER join assignments b ON b.asgtrsrcguid = a.rsrcguid
> INNER join timesheets c ON c.tishasgtguid = b.asgtguid
> INNER join users e ON e.userguid = a.rsrcuserguid
> INNER join persons f ON e.userpersguid = f.persguid
> INNER join timesheethistory g ON g.thistishguid = c.tishguid
> WHERE a.rsrchqnumber = 80000147
> and b.asgtassignmentid = 0000001234
> and c.tishactualenddate > '20050619'
> order by g.thisdaydate
> PRINT 'HEAT 3213'
>
|||Hi,
I have faced this problem just a month before.
u can do on thing
u can make 30 tables and tranfer the data to access database and carry
that access database anywhere .
in BCP file u have to maintain a lot.
in access u can create the table and keep on inserting in it.
hope that helps u
from
Doller
sql

No comments:

Post a Comment