473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SQL 8.x: Exporting Data into Excel

Helllo everyone. I am attempting to export tables from SQL v.8.x to Excel via DTS, but only one row is being created in Excel.

Below is the query and the results shown in SQL Analyzer. Only the first two lines (in bold) from the results export into Excel. I am new to SQL so please do not hesitate to ask questions. I appreciate any assistance offered. Thanks in advance.
set nocount on
declare @facility char(10),@mcount float, @tcount float
declare countManDef cursor for
select facility_code from cabinet..facility_file
open countManDef
fetch next from countManDef into @facility
while @@fetch_status <> -1
begin
Select @mcount =
(select count(distinct Id) from cabinet.dbo.follow_up f (nolock)
join audit.dbo.audit_trail a (nolock) on folder = encounter
and f.facility = a.facility
and a.occurred = f.created and a.action = 'C'
where f.facility = @facility)*1.0
Select @tcount =
((Select count(*) from cabinet.dbo.follow_up f where f.facility = @facility)*1.0)
If @tcount <> 0 and @tcount is not null
Select @facility as Facility, @mcount as [Manually Created], @tcount as [Total Created], 100*(@mcount/@tcount) as [Percent of Deficiencies created Manually]
Else
Select @facility as Facility, @mcount as [Manually Created], @tcount as [Total Created],0 as [Percent of Deficiencies created Manually]
fetch next from countManDef into @facility
end
close countManDef
deallocate countManDef
Facility Manually Created Total Created Percent of Deficiencies created Manually
---------- ----------------------------------------------------- ----------------------------------------------------- ----------------------------------------
0234 0.0 0.0 0


Facility Manually Created Total Created Percent of Deficiencies created Manually
---------- ----------------------------------------------------- ----------------------------------------------------- -----------------------------------------------------
A 14.0 23.0 60.869565217391312

Facility Manually Created Total Created Percent of Deficiencies created Manually
---------- ----------------------------------------------------- ----------------------------------------------------- ----------------------------------------
B 0.0 0.0 0

Facility Manually Created Total Created Percent of Deficiencies created Manually
---------- ----------------------------------------------------- ----------------------------------------------------- ----------------------------------------
C 0.0 0.0 0
Nov 19 '07 #1
0 889

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
4
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear"...
2
by: G | last post by:
When I export data from access to excel by with "export" or "Analyze with" I seem to loose parts of some fields (long text strings). Is there a way to export it all to excel? Thanks G
2
by: pmud | last post by:
Hi, I am exporting data from an EDITABLE DATA GRID EXCEL. But the 1st column in data grid is Edit Column. I want to display all columns in Excel except for the Edit column. The following...
2
by: bienwell | last post by:
Hi, I have a question about exporting data from datagrid control into Excel file in ASP.NET. On my Web page, I have a linkbutton "Export data". This link will call a Sub Function to perform...
21
by: bobh | last post by:
Hi All, In Access97 I have a table that's greater than 65k records and I'm looking for a VBA way to export the records to Excel. Anyone have vba code to export from access to excel and have the...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
1
by: 333sridhar333 | last post by:
Hi, I am having a problem in exporting a data from jsp to excel. I am getting the values from a servlet and populating it to a JSP. And form there i export them to Excel. The functionality...
2
by: 333sridhar333 | last post by:
Hi, I am having a problem in exporting a data from jsp to excel. I am getting the values from a servlet and populating it to a JSP. And form there i export them to Excel. The functionality...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.