Syncing BLOB results in 0 byte file

Hello, I have a custom VB program that scans a driver's license. The face image and text are then saved to the OLite client DB. However, when I sync to the server, the BLOB field is 0 bytes in the target table.
I have based the handling of the BLOB in my program on the BLOB sample code that is delivered with the Oracle Lite sample code <ora lite home>\mobile\sdk\samples\ado.net\win32\blob. When I run that code, it writes to the mobile client DB and then re-queries the BLOB, as it should. In order to test this with the sync, I then modified that sample code so that it writes the BLOB to my own table rather than the sample table. I then run msync, and it is also 0 bytes on the server. Is this some bug or maybe some setup that is missing? The code below is the section that handles the BLOB inserting and reading. I hope someone can help ... thanks in advance!
ryan
++++++++++++++++++++++++++++++++++++++
Private Sub Run()
Dim conn As OracleConnection
' Create Database
SetDone(lblCreate, False)
' Open database connection
Dim dsn As String = "dsn=IDMAN32_" & "emready;uid=system;pwd=IDMAN32"
conn = New Oracle.DataAccess.Lite.OracleConnection(dsn)
conn.Open()
SetDone(lblCreate, True)
' Create a table with a blob column
Dim cmd As IDbCommand
Dim blob As OracleBlob
SetDone(lblTable, False)
cmd = conn.CreateCommand()
' Create new BLOB object in polite database
SetDone(lblInsert, False)
blob = New OracleBlob(conn)
'Read data from the image file and write it into the blob
'in chunks
Dim file As FileStream
Dim browse As System.Windows.Forms.OpenFileDialog = New System.Windows.Forms.OpenFileDialog
browse.Filter = "Bitmap (*.bmp)|*.bmp|Gif (*.gif)|*.gif"
browse.Title = "Choose an Image File"
browse.ShowDialog()
Dim imageSrc As String = browse.FileName
Dim imageDes As String = "tmp.gif"
If imageSrc Is Nothing Or imageSrc.Length = 0 Then
imageSrc = "oracle.gif"
End If
file = New FileStream(imageSrc, FileMode.Open, FileAccess.Read)
Dim ImageData As Byte()
ReDim ImageData(file.Length)
Dim ArraySize As Integer = New Integer()
ArraySize = System.Convert.ToInt32(file.Length)
file.Read(ImageData, 0, ArraySize)
file.Close()
' Insert our image blob into the table using LiteParameter
cmd.CommandText = "insert into EMPLOYEE_STAGING (EMPLOYEE_ID, PHOTO) values(11000, ?)"
cmd.Parameters.Add(New OracleParameter("Image", blob))
cmd.ExecuteNonQuery()
cmd.Parameters.Clear()
conn.Commit() ' Commit transaction
SetDone(lblInsert, True)
' Read blob from the Database and write to a temp file
SetDone(lblRead, False)
Dim reader As IDataReader
cmd.CommandText = "select EMPLOYEE_ID, PHOTO from EMPLOYEE_STAGING WHERE EMPLOYEE_ID=11000"
reader = cmd.ExecuteReader()
If reader.Read() = False Then
cmd.Dispose()
conn.Close()
Throw New Exception("Failed to read blob")
End If
blob = reader.GetValue(1)
reader.Close()
file = New FileStream(imageDes, FileMode.Create, FileAccess.Write)
file.Write(ImageData, 0, ArraySize)
file.Close()
' Close database connection
conn.Close()
SetDone(lblRead, True)
' Display bitmap
Dim bmp As Bitmap
bmp = New Bitmap(imageDes)
bmpBox.Image = bmp
End Sub

Oracle just posted a sample today as well.
Caution
This sample code is provided for educational purposes only and not supported by Oracle Support Services. It has been tested internally, however, and works as documented. We do not guarantee that it will work for you, so be sure to test it in your environment before relying on it.
Proofread this sample code before using it! Due to the differences in the way text editors, e-mail packages and operating systems handle text formatting (spaces, tabs and carriage returns), this sample code may not be in an executable state when you first receive it. Check over the sample code to ensure that errors of this type are corrected.
Sample Code
Create the Oracle Lite Database
1. Create a new folder c:\ClobTest.
2. Open a Command Prompt.
3. Issue the command CREATEDB ClobTest c:\ClobTest\ClobTest.odb test.
4. Exit the command prompt.
Create the ODBC Data Source Name
1. Open the ODBC Data Source Administrator.
Start, run, odbcad32.exe.
2. Under either User DSN or System DSN, click Add.
3. Select Oracle Lite 40 ODBC Driver and click Finish.
4. Enter the following configuration information:
Data Source Name: ClobTest
Data Description: Clob Test Database
Database Directory: C:\ClobTest
Database: ClobTest
Default Isolation Level: Read Committed
Autocommit: Off
Default Cursor Type: Forward Only
5. Click OK and close the ODBC Data Source Administrator.
Create Oracle Database Lite Table
1. Open a Command Prompt.
2. Connect to the ClobTest Database with mSQL.
msql system/Test@jdbc:polite:ClobTest.
3. Create the TEST_CLOB table.
create table TEST_CLOB(
field1 VARCHAR2(60) PRIMARY KEY,
text CLOB);
commit;
4. Exit msql and exit the Command Prompt.
Create the Visual Studio 2005 C# ClobTest Project
1. Launch Visual Studio 2005.
2. Select Create Project.
3. Select the Visual C# Language and Windows for the project type, select the Windows Application template, name the project ClobTest, and click OK.
Reference the Oracle Database Lite ADO.Net 2.0 provider
1. Select Project, Add Reference.
2. Select the Browse tab.
3. Navigate to the <Olite SDK Home>\Mobile\Sdk\ado.net\v2.x direcotry.
4. Highlight Oracle.DataAccess.Lite_w32.dll file and click OK.
Create the ADO.Net ClobTest Application
1. Add the following class declarations to the declarations already contained by default:
using System.IO;
using Oracle.DataAccess.Lite;
using Oracle.Lite.Data;
using System.Diagnostics;
2. Declare a LiteConnection object in class scope.
LiteConnection con;
3. Instantiate the connection object in the Form_Load method.
con = new LiteConnection("DataDirectory=C:\\ClobTest;Database=ClobTest;DSN=*;uid=system;pwd=test");
4. Create a button object named cmdInsert wtih a text property of Insert.
5. Add the following code to the cmdInsert_Click method:
LiteCommand cmd = new LiteCommand(con);
byte[] buffer = new byte[5];
long lngOffset = 0;
try
con.Open();
Debug.Print("Connection Open");
LiteLob clobText = new LiteLob(con);
buffer = Encoding.UTF8.GetBytes("Smile");
//Clob Max = 2000000000 so with 5 max setting should be 400000000)
while(lngOffset < 400)
clobText.SetBytes(lngOffset, buffer, 0, 5);
lngOffset += 5;
cmd.CommandText = "INSERT INTO TEST_CLOB VALUES('Record 1', ?)";
cmd.Parameters.Add(new LiteParameter("text", clobText));
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
con.Commit();
MessageBox.Show("Clob Successfully Inserted", "Done");
catch (Exception ex)
Debug.Print(ex.Message);
finally
if (con.Connection.State == ConnectionState.Open)
con.Close();
Debug.Print("Connection Closed");
6. Create a button object named cmdRetrieve wtih a text property of Retrieve.
7. Add the following code to the cmdRetrieve_Click method:
LiteCommand cmd = new LiteCommand(con);
IDataReader dr;
FileStream file;
byte[] buffer = new byte[256];
long lngOffset = 0;
long chunk;
try
con.Open();
Debug.Print("Connection Open");
cmd.CommandText = "SELECT * FROM TEST_CLOB WHERE FIELD1 = 'Record 1'";
dr = cmd.ExecuteReader();
dr.Read();
LiteLob clobText = new LiteLob(con);
clobText = (LiteLob)dr["TEXT"];
file = new FileStream("c:\\ClobTest\\Retrieve.txt", FileMode.Create);
Debug.Print("Text File Created");
do
chunk = clobText.GetBytes(lngOffset, buffer, 0, 256);
file.Write(buffer, 0, (int)chunk);
lngOffset += chunk;
while (chunk != 0);
file.Close();
Debug.Print("Text File Closed");
MessageBox.Show("Clob Successfully Retrieved", "Done");
catch (Exception ex)
Debug.Print(ex.Message);
finally
if (con.Connection.State == ConnectionState.Open)
con.Close();
Debug.Print("Connection Closed");
Compile and test the sample
1. Select the Debug menu and choose Start Debugging.
2. Click on the Insert button to insert Clob data into the Oracle Lite database. The size of the Clob data may be altered by changing the while loop while(lngOffset < 400) to use a larger value.
3. Click on the Retrieve button to retrieve the Clob data from the database and write it as a new file.
4. Verify that the Retrieve.txt file is created in the c:\ClobTest folder and that the text may be viewed
correctly.

Similar Messages

  • Using my Mac all pdfs result in zero byte files

    I have uninstalled and reinstalled with the same result.

    This sounds very alarming. Please help us understand what you are seeing as it is not typical and may even be unique. For instance,
    * are these old PDFs which used to be fine but which now are not?
    * is it new PDFs that you are making (how)?
    * how do you see that they are zero bytes?
    * what Mac OS?
    * anything else you can think of especially, other strange things starting around the same time.

  • File adapter causes FTP process stop result 0 byte file.

    Has anyone ever heard that FTP adapter can cause FTP process to stop and end up with 0 byte file transferred?
    We use the normal ftp script to ftp file from external file server place file in XI inbound folder so that file adapter can pick them up from that folder.
    We have encounter a few 0 byte FTPed file in our system. One suspecting is the network between XI server and file server might get some interruption. With out just blaming on the network. We would like to know if there is any possibility that it is also causes by our file adapter? Says, it try to read the file that is not yet complete transferring make FTP give up transferring??
    We would like to know if FTP process is transferring the file over and file adapter try to read, what will happen? Will it read file with incomplete content and ftp still go on? Or will it stop reading and return back error as the file could not be open? Or it will force FTP process to let go the file??
    Best rgds,
    Thida

    Hi,
    ><i>We would like to know if there is any possibility that it is also causes by our file adapter? Says, it try to read the file that is not yet complete transferring make FTP give up transferring??</i>
    have not seen the file adapter causing any such problems. So, it looks like a network issue.
    ><i>We would like to know if FTP process is transferring the file over and file adapter try to read, what will happen? Will it read file with incomplete content and ftp still go on? Or will it stop reading and return back error as the file could not be open? Or it will force FTP process to let go the file??</i>
    Am not exactly sure, but when a file is being created and the file adapter tries to read such a file, the file would be READ and WRITE Locked and so File adapter should not be able to read such a file until the creation of the file is complete.
    Also, take a look at the note :  <b>821267</b> , question 31 for how file adapter processes empty file.
    Regards,
    Bhavesh

  • Please help, I need to read blob and output in bytes from wwv_flow_files.

    Hi all,
    I am having a requirement to read a blob stored in the oracle table and convert it into bytes. I am loading this table (wwv_flow_files) with APEX.
    The code under page 1 is as follows:
    DECLARE
    z number;
    y varchar2(4000);
    x varchar2(400);
    b blob;
    BEGIN
    select filename,blob_content into x ,b from APEX_APPLICATION_files where name =:P1_FILE_NAME;
    select length(convertBlobToBytes(b)) into z from dual;
    :P1_RESULT := z;
    end;
    Java code is as follows:
    import java.io.*;
    import java.sql.Blob;
    public class convertBlob {
    * @param blob
    * @return
    public static byte[] convertBlobToBytes(Blob blob) {
    if (blob==null) return null;
    try {
    InputStream in = blob.getBinaryStream();
    int len = (int) blob.length(); //read as long
    long pos = 1; //indexing starts from 1
    byte[] bytes = blob.getBytes(pos, len);
    in.close();
    return bytes;
    catch (Exception e) {
    System.out.println(e.getMessage());
    return null;
    PL/SQL wrapper is as follows:
    CREATE OR REPLACE FUNCTION convertBlobToBytes(p1 IN BLOB) RETURN LONG RAW AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'convertBlob.convertBlobToBytes(java.sql.Blob) return byte[]';
    I loaded this java class and pl/sql wrapper into the database using JDEVELOPER.
    But I am getting the length of the file, as twice the size.
    For example, When I run the program which reads the file returns the length of the file as a byte array, the length is 819.
    When I pass the same file as a blob from apex, to the java program that converts blob to bytes, the length of the file is 1638.
    And hence I am getting wrong results, further in the process.
    Can you please help me? Any help is appreciated.
    rgds,
    Suma.

    The example on this page is showing how to read a blob in portions you determine yourself:
    http://apex.oracle.com/pls/otn/f?p=31517:91
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Plesae help- needing to read a blob from db into bytes[]

    Hi all,
    I am having a requirement to read a blob stored in the oracle table and convert it into bytes. I am loading this table (wwv_flow_files) with APEX.
    The code under page 1 is as follows:
    DECLARE
    z number;
    y varchar2(4000);
    x varchar2(400);
    b blob;
    BEGIN
    select filename,blob_content into x ,b from APEX_APPLICATION_files where name =:P1_FILE_NAME;
    select length(convertBlobToBytes(b)) into z from dual;
    :P1_RESULT := z;
    end;
    Java code is as follows:
    import java.io.*;
    import java.sql.Blob;
    public class convertBlob {
    * @param blob
    * @return
    public static byte[] convertBlobToBytes(Blob blob) {
         if (blob==null) return null;
         try {
         InputStream in = blob.getBinaryStream();
         int len = (int) blob.length(); //read as long     
    long pos = 1; //indexing starts from 1
         byte[] bytes = blob.getBytes(pos, len);           
    in.close();
         return bytes;     
    catch (Exception e) {
         System.out.println(e.getMessage());
         return null;
    PL/SQL wrapper is as follows:
    CREATE OR REPLACE FUNCTION convertBlobToBytes(p1 IN BLOB) RETURN LONG RAW AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'convertBlob.convertBlobToBytes(java.sql.Blob) return byte[]';
    I loaded this java class and pl/sql wrapper into the database using JDEVELOPER.
    But I am getting the length of the file, as twice the size.
    For example, When I run the program which reads the file returns the length of the file as a byte array, the length is 819.
    When I pass the same file as a blob from apex, to the java program that converts blob to bytes, the length of the file is 1638.
    And hence I am getting wrong results, further in the process.
    Can you please help me? Any help is appreciated.
    rgds,
    Suma.

    Hi all,
    Can any of you please help me out?
    rgds,
    Suma.

  • Zero Byte Files

    When I ran a smart folder consisting of all files with Zero bytes, I got a dozens of them (including a lot in the preference folder).  Is this normal?  Should I be trashing any of these or do they serve some purpose?  I have a MacBook Pro running OSX 10.7.4.

    This turned out to be a user error. However, I realized this after fixing the error by deleting the follwoing files:
    Check if the issue exists with another user? Continue if the issue is not reproducible.
    Delete all the preferences from ~/Library/Preferences/*.*
    This fixed the issue. However, while deleting the plist files, I realized that the issue was as a result of bad task I created in Automator. The process was replicating the zero byte files. The issue could've been resolved had I traced my steps back to the time when I first saw the problem. Could've save me some time in customizing my desktop from scratch.

  • Ftp get results in zero bytes payload and no exception every now and then

    hi *,
    i just wanted to ask if some of you have also seen the problem that every now and then a file retrieved by retrieveFile via batchftp otd results in zero bytes instead of its original file size without any exceptions. it happens every 2-3 weeks and we nowadays circumventing it by checking the size of the file listing against the size in bytes retrieved. ftp server says xyz bytes successfully sent to client in this case.
    anyone seen similar?
    regards chris

    hi alexander,
    i did what i can ....
    ftp server in every case always said
    sent XXXX bytes instead of saying zero. and i trust the ftp server a little more than our batch ftp adapter.
    would you consider this as ruling out?
    regards chris

  • In Premiere I can edit an avi or mov clip but I can not save the result as a like file.  Why not???

    In Premiere I can edit an avi or mov clip but I can not save tghe result as a like file.  What do I have to do???  It only saves a project.  Under 'File' the 'Export' function is greyed out.  I need help baddly.
    [email protected]
    Bill Schoon

    Boatbuilder
    Let us start from the beginning.
    It has been established that you have Premiere Elements 10. On what computer operating system is it running?
    There has not been a File Menu/Export/Movie export opportunitity in Premiere Elements since version 7. We are not up to version 12.
    For Premiere Elements 10, your export opportunities are all in Share/ including one for Computer. Under Computer there are several choices. The ones that you see are Adobe Flash Video, MPEG, and AVCHD. The others you have to scroll down to. And those choices are AVI, Windows Media, QuickTime, Image, and Audio. You do not have to use the scroll bar for this. You can click on Adobe Flash Video panel to get it to turn black. Then use the down arrow to go down the list and the up arrow to go up the list. Once you get to a category, you can select a preset and go with it or customize it under the Advanced Button/Video Tab and Audio Tab of the preset.
    If you post the properties of your source media that you want to try to match in the export, I would be glad to suggest the exact settings for you.
    We will be watching for your follow up with details.
    Thank you.
    ATR
    Add On...The Premiere Elements 10 File Menu is for more than Saving, just not exporting. One of the key features that can be access there is the Project Archiver. More on that another time.

  • How can I remove the Location column from the search results in a .chm file?

    How can I remove the Location column from the search results in a .chm file?
    I generated the file in Robohelp HTML 9.
    As far as I know it's used when you've combined more than one source into the final help file. It is possible (though I don't remember doing it) that I did that once a couple of years ago but now I'm only using one source - the project that's generating the .chm.
    Can anyone tell me how I can remove it?
    Thanks
    Tom

    In Project Setup look at the Window properties. I think you will find Advanced Search is ticked.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • I have a new hard drive on my imac  I want to sync my ipad(which has the files I lost when my old hard drive died), which holds the files I lost when my old hard drive died.  How can I sync my ipad with my new hard drive?

    My hard drive on my IMac died, so I have a new hard drive.  I want to sync my Ipad(which has the files I lost when my old hard drive died) back with my IMac. How can I sync my Ipad with my new IMac hard drive without erasing my legacy files on the Ipad at the same time?

    Copy everything from your backup copy of your cpomputer to your new hard drive.

  • How to create a table with datatype blob and insert a pdf file (ravi)

    how to create a table with datatype blob and insert a pdf file,
    give me the explain asap
    1.create the table?
    2.insert the pdffiles into tables?
    3.how to view the files?
    Thanks & Regards
    ravikumar.k
    Edited by: 895044 on Dec 5, 2011 2:55 AM

    895044 wrote:
    how to create a table with datatype blob and insert a pdf file,
    give me the explain asapPerhaps you should read...
    {message:id=9360002}
    especially point 2.
    We're not just sitting here waiting to answer your question as quickly as possible for you.

  • Failed iPhone sync as iTunes states random song files "could not be read". I politely ask for your help!

    Hello
    Been having this problem for awhile now:
    When I attempt to sync my iPhone, iTunes will start syncing but after every few songs it syncs, iTunes interrupts the sync with a message saying the file could not be imported since it could not be read. I can go to that song iTunes can't import in my list of music and play it in iTunes and verify that it isn't corrupted.
    Does anyone know what the issue is? Here is what I have tried so far:
    * Restore entire iPhone
    * Remove iTunes and all preferences, re install and re import music library
    * Change file import settings to iTunes Plus AAC conversion (Not sure this even does anything)
    * Manually converting EVERY song (Shift+Clicking) to AAC
    * Attempt to sync music manually (e.g. only checked items)
    The message is as follows: iTunes could not copy "such and such song" to the iPhone because the file could not be read. This error happens with a different song each time I remove the previous one indefinitely, I have over 3000 songs, and it would take me days before I could manually remove each song iTunes deems unworthy of syncing (if at all). And this ONLY happens if I am fortunate enough for iTunes to even attempt to sync the tracks, usually it just skips that step entirely saying it's been completed, with no music actually transferred...
    I am leaving on an international trip soon and I very much want to have hard copies of my music with me, I've been wracking my brain for ages now and haven't been this frustrated since freshmen year of highschool.
    (╯°□°)╯︵ ┻━┻
    * iPhone 5S - iOS 7.1.1
    * Windows 8.1
    * iTunes 11.2.2
    TL;DR: Everytime I try to sync my songs onto my iPhone, I get an error message that says "iTunes could not copy "(song name)" to the iPhone because the file could not be read or written." and then it stops syncing completely, so the rest of the songs after that don't get put on my iPhone. File is playable and not corrupt.

    Hi skyvandyk,
    It sounds like one of your music files may have been corrupted at some point and when trying to sync that song the iPhone is unable to do so. I know this must be a frustrating issue for you.
    What I would suggest is that you first attempt to sync your iPhone without that particular song. To do this you will need to manually manage the music that goes to your iPhone. This article will tell you how -
    Managing content manually on iPhone, iPad, and iPod
    http://support.apple.com/kb/HT1535
    If the song was purchased from the iTunes store you can delete it and download again at no cost, if it is still available. See this article -
    Download past purchases
    http://support.apple.com/kb/HT2519
    If the song came from a CD or another source you may have to get it again from that source.
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • I am using Tiger, 10.4.11, and have an iPod classic 120gb working fine.  Just got a 160gb classic and would like to sync it to same i-Tunes file.  It said "must have iTunes 9.0 or later to sync."  If upgrade i-Tunes to 9.0.2, will my 120gb iPod sync o.k?

    I am using Tiger, 10.4.11 and have an iPod classic 120 gb working fine with about 7 gb of music on it.  I just got another iPod classic 160 gb for my wife, and would like to sync it to the same iTunes file, but I got a message which says I must upgrade to iTunes 9.0 or later.  If I upgrade to 9.0, will my 120 gb iPod be o.k. with that?  Rumor:  I have heard that iTunes 9.0 or later changes the format of the music.

    Thanks to all for reviewing my question.  I am trying to avoid a possible disaster here, having to load about 90 cd's all over again.  If anyone knows, could you tell me what will happen if I download iTunes 9.0, and install it.  Will it copy all of my music into it, or fail to recognize it, or recognize 8.0 and just upgrade rather than replace it?  Thanks again.  Tom

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?

    I want to do the below task using powershell script only.
    I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
    This image is csv file only. 
    Could you please any one help me.
    Thanks in advance.
    By
    A Path finder 
    JoSwa
    If a post answers your question, please click &quot;Mark As Answer&quot; on that post and &quot;Mark as Helpful&quot;
    Best Online Journal

    Not certain this is what you're after, but this :
    #import the contents of both csv files
    $dbexcel=import-csv c:\dbexcel.csv
    $liveexcel=import-csv C:\liveexcel.csv
    #prepare the output csv and create the headers
    $outputexcel="c:\outputexcel.csv"
    $outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
    $outputline | out-file $outputexcel
    #Loop through each record based on the number of records (assuming equal number in both files)
    for ($i=0; $i -le $dbexcel.Length-1;$i++)
    # Assign the yes / null values to equal the word equivalent
    if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
    if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
    #create the live of csv content from the two input csv files
    $outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
    #output that line to the csv file
    $outputline | out-file $outputexcel -Append
    should do what you're looking for, or give you enough to edit it to your exact need.
    I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers).

  • How to call a SP with dynamic columns and output results into a .csv file via SSIS

    hi Folks, I have a challenging question here. I've created a SP called dbo.ResultsWithDynamicColumns and take one parameter of CONVERT(DATE,GETDATE()), the uniqueness of this SP is that the result does not have fixed columns as it's based on sales from previous
    days. For example, Previous day, customers have purchased 20 products but today , 30 products have been purchased.
    Right now, on SSMS, I am able to execute this SP when supplying  a parameter.  What I want to achieve here is to automate this process and send the result as a .csv file and SFTP to a server. 
    SFTP part is kinda easy as I can call WinSCP with proper script to handle it.  How to export the result of a dynamic SP to a .CSV file? 
    I've tried
    EXEC xp_cmdshell ' BCP " EXEC xxxx.[dbo].[ResultsWithDynamicColumns ]  @dateFrom = ''2014-01-21''"   queryout  "c:\path\xxxx.dat" -T -c'
    SSMS gives the following error as Error = [Microsoft][SQL Server Native Client 10.0]BCP host-files must contain at least one column
    any ideas?
    thanks
    Hui
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

    Hey Jakub, thanks and I did see the #temp table issue in our 2008R2.  I finally figured it out in a different way... I manage to modify this dynamic SP to output results into
    a physical table. This table will be dropped and recreated everytime when SP gets executed... After that, I used a SSIS pkg to output this table
    to a file destination which is .csv.  
     The downside is that if this table structure ever gets changed, this SSIS pkg will fail or not fully reflecting the whole table. However, this won't happen often
    and I can live with that at this moment. 
    Thanks
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

Maybe you are looking for

  • Fire wire

    my fire wire doesnt recognise a camera or a hard disk can i get it repaired or do i need a new card!!??

  • I need a doctor for broadband

    I have no interest in music nor do I save more than a very modest collection of photos, thus I've been comfortable with running Panther on my PC3 600 MHz iBook. But recently, Comcast became available in my area and I do have a very large interest in

  • How to view backup data on PC

     I have been backing up address book from my BB  via desktop manager to a file on my PC,  How can I view the files (old address book)on my PC, is it possible? It seems as if i would have to transfer it back to the BB, which would delete the current o

  • Pls explain

    Hi, Could anyone pls tell me what actually it means by doing this: Map map = new HashMap(); or Map map = new HashTree(); Actually Map is an interface and HashMap implements it..But if we do like this HashMap map = new HashMap(); still we will be able

  • Reset sync services in Yosemite

    how can I reset sync services in Yosemite?