Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2005, 09:15 AM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to Not Create File If No Rows

I am using a SQL stored procedure to select data and then output the results to a CSV file.

However if the stored procedure returns no rows, I would not like a CSV file to be created. I only want a CSV file created if there is data in the file.

I find that the DTS package - using the Data Transformation task produces a file regardless of whether the file has data or not.

Does anyone know how to stop the production of a CSV file if there are no rows returned by the SQL query?

Regards

Phillip

 
Old November 9th, 2005, 04:17 PM
Authorized User
 
Join Date: Sep 2005
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you have to add a step beforehand where you check the count of the sp
if the count = 0 end
if it's > 0 produce the file
You can store this in a global variable

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" -- http://sqlservercode.blogspot.com/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Read CSV file - Save Columns into Rows pintoo BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 August 20th, 2008 09:01 AM
Read all rows from text file shai505 C# 5 April 28th, 2006 09:37 PM
dynamically create table rows onChange of select crmpicco Classic ASP Basics 0 August 18th, 2005 07:01 AM
Use Rows from a DataTable to Create Columns In oth indigolion Classic ASP Professional 0 August 5th, 2005 12:44 PM
how to edit/ update records/ rows of csv file vb thePervertedMonk VB How-To 1 December 10th, 2004 02:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.