SQL Server Insert

Hey gang, i was trying to test loading data into sql server via JDBC.
Here i am having problem. I have no problem inserting into columns, where the data type is 'int', and 'float' (SQL Server column type). But i am running into problem when i try to insert into data type 'text' (SQL Server column type).
here the code, may be this will explain better ;)
//DBConnection Class
public int executeUpdate(String sql, String [] parameter){
    int count=0;
    try {
      PreparedStatement stmt = conn.prepareStatement(sql);
      for (int i=0;i<parameter.length;i++){
        stmt.setObject(i+1,parameter);
stmt.executeUpdate();
stmt.close();
catch (Exception ex){
close();
return count;
//Main class where i call the function above
public static void main(String[] args) {
Main main1 = new Main();
DBConnection db = new DBConnection();
db.executeUpdate("Insert into pavan (text) values (?)",new String[]{"Pavan"});
db.close();
Also one more not, when i try to see the value on this insert, all i see '<Long text>' in SQL Server Enterprise Manager.

I believe that occurs when you have more characters than can be handled with the 'Text' datatype. You could potentially increase the length of your field, or use another datatype such as 'Varchar'

Similar Messages

  • Create and insert into table from Oracle to MS SQL server.

    Hello,
    Oracle Database 11g and Red hat 5
    I have a very different kind of issue. I am handling the ORACLE db(remote db with all the important data). On the other side their is a MS SQL server db(local db with some testing data in it). All the users will access the ORACLE db for the actual processing but for sometime they need to apply some of their own concepts. So they will transfer the data from ORACLE to MS sql server.
    I want to create a code in ORACLE db like a procedure , which will create a table in MS sql server , insert data into it,Also create some metadata table to keep some of my table's info on MS SQL serve db,If the table is present it should append the data, .... like many things ...
    Overall my question is , how can i write a code to make these operation on a remote db, that to these operations are DDL and on MS SQL Server(Non-Oracle) ???
    Please guide me with some ideas or solutions ...
    Also provide if you have some good links to study ...
    thanks in advance.

    I'm not sure why you never visit http://tahiti.oracle.com prior to asking any question. Is it forbidden in your locale? Are you afraid of it? Will your salary be decreased when you visit the documentation?
    http://www.oracle.com/pls/db111/search?word=sql+server&partno=
    should provide sufficient information.
    Your doc question must be considered a violation of Forum Etiquette and an abuse of this forum.
    Sybrand Bakker
    Senior Oracle DBA

  • Installing CE with SQL Server

    Hi,
    I have SQL server Developer edition (version 8.00) , OS : Vista
    I am trying to install CE  and I am getting the follwoing error during the installation wizard
    ERROR      2009-12-19 13:08:59.602 [sixxcstepexecute.cpp:984]
    FCO-00011  The step dAskForConnection with step key |CE_DevSystem_App|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|3|0|NW_GetSidNoProfiles|ind|ind|ind|ind|1|0|NW_getDBInfo|ind|ind|ind|ind|3|0|NW_MSS_DBINFO|ind|ind|ind|ind|3|0|MssLoginInfo|ind|ind|ind|ind|0|0|dAskForConnection was executed with status ERROR .
    WARNING    2009-12-19 13:08:59.649 [iaxxejshlp.cpp:150]
    Could not get property IDs of the JavaScript object.
    ERROR      2009-12-19 13:08:59.649 [iaxxejsctl.cpp:492]
    FJS-00010  Could not get value for property .
    ERROR      2009-12-19 13:08:59.587
               lib=iamodmssql module=CIaNtMssDmo
    MDB-05053  Errors when executing sql command: [Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name or number of supplied values does not match table definition.
    [Microsoft][ODBC Driver Manager] Function sequence error
    <p> SOLUTION: If this message is displayed as a warning, you can ignore it. If this is an error, contact SAP support.</p>
    Regards, Anil

    Hi
    Have a look on this resolved thread. [HELP |SQL2005 Upgrade Error in Post-Processing - HELP PLEASE;
    Best Regards
    Satish Kumar

  • Best Practice to fetch SQL Server data and Insert into Oracle Tables

    Hello,
    I want to read sqlserver data everry half an hour and write into oracle tables ( in two different databases). What is the best practice for doing this?
    We do not have any database dblinks from oracle to sqlserver and vice versa.
    Any help is highly appreciable?
    Thanks

    Well, that's easy:
    use a TimerTask to do the following every half an hour:
    - open a connection to sql server
    - open two connections to the oracle databases
    - for each row you read from the sql server, do the inserts into the oracle databases
    - commit
    - close all connections

  • Inserting data to a . SDF database (SQL Server Compact Edition connection)

    Hi, all.
    I'm working on a project that worked fine while connecting to SQL Server 2008. I used a connection string like this:
    Driver={SQL Server Native Client 10.0};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
    Now, I've replaced all database connections in my project to work with SQL Server Compact Edition, and my connection string is something like this:
    Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=myDir\myDataBase.sdf; 
    After changing the type of connection, I'm getting an error on "DB Tools Insert Data.vi". This is what I get:
    Error -2147217872 occurred at NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib: DB Tools Insert Data.vi->Main.vi
    Possible reason(s):ADO Error: 0x80040E30 Exception occured in Microsoft SQL Server Compact OLE DB Provider: The given type name was unrecognized. [,,,,,] in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib: DB Tools Insert Data.vi->Main.vi
    This is a simplified block diagram (as I said, it worked perfectly while using SQL Server 2008 connection):
    Could you please help me?
    Thanks in advance,
    Francisco

    Hi, Steve. Thanks for your answers.
    I worked around this problem by using directly a SQL query instead of this function (you were right, using DBTools Execute Query VI). But now I'm getting problems with other functions, when inserting data into the DB including NULL values.
    I make a SQL query like this using DBTools Execute Query VI:
    INSERT INTO Table1 (Column1, Column2, Column3, Column4, Column5, Column6) VALUES ('Value1', 'Value2', 'Value3', 'NULL', 'Value5', 'Value6') 
    and get the following error:
    ADO Error: 0x80040E07Exception occured in Microsoft SQL Server Compact OLE DB Provider: A literal value in the command could not be converted to the correct type due to a reason other than data overflow. [,,,,,] in NI_Database_API.lvlib:Conn Execute.vi->INSERT (new) restricción (DBCT).vi->Restricciones a Base de Datos (DBCT).vi->Definir - editar restricciones.vi->Main.vi
    The same SQL query worked perfectly when using the SQL Server 2008 connection, so it's not a database structure issue.
    Could somebody please help me?
    Regards,
    Francisco

  • How to insert a JPG image in a column of type "image" in sql server 7.0 ??

    hi all,
    I have a table with 2 columns.
    First col is of "Name" and second col is of type "image" .
    I am using sql server 7.0 on window 2000.
    now i have created table. I want to insert a jpg/gif image in its 2nd column.
    How can i do so ? and how i can i read the image object after insertion ?
    I am using 2nd col of type "image" and NOT Binary or varBinary.
    Any idea will be highly appreciated.
    Thanks in advance.
    AlwaysJava

    hi all,
    I have a table with 2 columns.
    First col is of "Name" and second col is of type
    "image" .
    I am using sql server 7.0 on window 2000.
    now i have created table. I want to insert a jpg/gif
    image in its 2nd column.
    How can i do so ? and how i can i read the image
    object after insertion ?
    I am using 2nd col of type "image" and NOT Binary or
    varBinary.
    Any idea will be highly appreciated.
    Thanks in advance.
    AlwaysJavaHi,
    Below are some excerpts from my program.. which was doing image insertions and retrievals also.. I have included the image insertion and retrieval portion.. retrieval can be done in more than one ways.. one of them is given.. for very large images, u can read chunks of data from the input stream and write it to the disk. for smaller ones , the given methods work very well..
    I tested the program with jdk1.4.0 and aveConnect3.0 driver. on an
    SQL server 7 machine from my box running windows 2000... and it worked..
    Im not still sure if this is the optimised way.. there can be other more optimised methods..
    hope this clears your problem..
    cheers,
    -Jer
        Connection conn = null;
        Statement stmt = null;
        ResultSet rst = null;
        PreparedStatement pstmt = null;
        FileInputStream fis = null;
        FileOutputStream fop = null;
        File file = null;
        InputStream is = null;
        String createtable = "Create table testtable (name varchar(32),_image image)";
        String inserttable = "Insert into testtable values (?,?)";
        String retrievetable = "Select _image from testtable";
        String droptable = "Drop table testtable";
        String url = "jdbc:AvenirDriver://CodeServer:1433/test";
        conn = DriverManager.getConnection(url,"test","test");
    //Create the table
        stmt = conn.createStatement();
        stmt.execute(createtable);
    //Insert the file into the table
        file = new File("input.gif");
        fis = new FileInputStream(file);
        pstmt = conn.prepareStatement(inserttable);
        pstmt.setString(1,file.getName());
    //Set the filestream to the binary stream into the image in the table
        pstmt.setBinaryStream(2,fis,fis.available());
    //Updating the table
        pstmt.executeUpdate();
    //clean up the streams and atatement
        fis.close();
        pstmt.close();
    // Retrieve the image from the table..
        pstmt =  conn.prepareStatement(retrievetable,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
    // execute the Query
        rst = pstmt.executeQuery();
    //jump to the first row of the resultset
        rst.beforeFirst();
        rst.next();
    //get the inputstream from the image object in the  result set
        is = rst.getBinaryStream(1);
    //Writing the data in the inputstream into an outputfile
              //Using getbytes method from the result set
                   byte[] bytearray = rst.getBytes(1);
                   baos = new ByteArrayOutputStream();
                  baos.write(bytearray);
                  fop = new FileOutputStream ("output.gif");
                  baos.writeTo(fop);
    //using the input stream and storing the data in bytearray
    //allocating the buffer size to store the data from inpuit stream ... here whole inptstream is allocated..
    //(The buffer size can be varied if the file is too large and the reading be..
    //  ..done in loop , to read small chunks from the input stream and write it to the file)
        byte[] bytearray = new byte[is.available()];
    //to write the data in the byte array into an output file
        baos = new ByteArrayOutputStream();
        baos.write(bytearray);
        fop = new FileOutputStream ("output.gif");
        baos.writeTo(fop);

  • Error when insert data in Sql Server table(DateTime data type)

    Hello all,
    I have created a database link in oracle 11g to SQL Server 2008 using Sqlserver gateway for oracle,Oracle run on Linux and SQL Server run on Windows platform.
    I have queried a table and it fetches rows from the target table.
    I am using this syntax for insert a row in Sql Server table.
    Insert into Prod@sqlserver (NUMITEMCODE, NUMPREOPENSTOCK, NUMQNTY, NUMNEWOPENSTOCK, DATPRODDATE , TXTCOMPANYCODE, "bolstatus", NUMRESQNTY )
    Values (1118 , 1390.0 , 100.0 ,1490 , '2012-06-23 12:37:58.000','SFP' ,0 , 0 );
    but it give me error on DATPRODDATE,The data type of DATPRODDATE column in Sql Server is DATETIME.
    My Question is how can i pass the date values in INSERT statement for Sql Server DateTime data type.
    Regards

    Just as with Oracle, you have to specify the date using the to_date() function or use the native date format for the target database (if you can figure out what that is). This is good practice anyway and a good habit to get into.

  • Error while inserting data in SQL Server.

    Hi',
    I am using SOA 11.1.1.5
    I am inserting data using DB adapter in MS SQL Server. Some times I get below error.
    Error Message: {http://schemas.oracle.com/bpel/extension}bindingFault
    Fault ID     rrr/xxx!1.1*soa_313bd437-7bb9-41c6-a719-d1775b9afc4b/xx/4115908-BpInv0-BpSeq1.6-4
    Fault Time     Dec 24, 2012 8:02:09 AM
    Non Recoverable System Fault :
    <bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception. insert failed. Descriptor name: [InsertIntoStagingxx.Stagingxx]. Caused by java.sql.BatchUpdateException: String or binary data would be truncated.. Please see the logs for the full DBAdapter logging output prior to this exception. This exception is considered not retriable, likely due to a modelling mistake. To classify it as retriable instead add property nonRetriableErrorCodes with value "-8152" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary></part><part name="detail"><detail>String or binary data would be truncated.</detail></part><part name="code"><code>8152</code></part></bindingFault></bpelFault>
    Please advice.
    Thanks
    Yatan

    Hi Yatan,
    This should be due to data issues. And the error message is due to data truncation issues.
    Please check your payload that you are trying to insert into the SQL server table.
    One or more fields might have a data that is exceeding its defined length with respect to the table definitions.
    Problem with using SQL server is that while inserting, you will not be pointed towards which field or column is causing the error.
    You have to take the pain of searching through the entire payload to find the problem causing ones.
    Thanks,
    Deepak.

  • RE:ora-28500 when trying to insert into SQL Server table

    Hi all!
    I'm getting this when i attempt to insert into my table test in a SQL Server database. As u can see from the select, the database link seems ok. Any ideas plz. Thnx..
    SQL> select "idAges" from test@try2;
    no rows selected
    SQL> insert into test@try2 ("idAges","nARAges","nAPAges") values(10,'','');
    insert into test@try2 ("idAges","nARAges","nAPAges") values(10,'','')
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Generic Connectivity Using ODBC][Microsoft][ODBC SQL Server Driver][SQL
    Server]Cannot insert explicit value for identity column in table 'test' when
    IDENTITY_INSERT is set to OFF. (SQL State: 23000; SQL Code: 544)
    ORA-02063: preceding 2 lines from TRY2

    IDENTITY_INSERT on works only for particular session and for one table. It's not global variable.
    The only idea what I have is to create link from MS Sql to Oracle (right now You have oracle ->ms sql)and then before insert You will set identity_insert on and will run insert.

  • INSERTING DATA INTO A SQL SERVER 2005 TABLE, WHICH HAS A IDENTITY COLUMN

    Hi All,
    I have to insert the data into a SQL SERVER 2005 Database table.
    I am able to insert the data into a normal SQL Server table.
    When I am trying to insert the data into a SQL Server table, which has a identity column (i.e. auto increment column in Oracle) I am getting error saying that can't insert value explicitly when IDENTITY_INSERT is set to OFF.
    Had anybody tried this??
    There are some SRs on this issue, Oracle agreed that it is a bug. I am wondering if there is any workaround from any one of you (refer Insert in MS-SQL database table with IDENTITY COLUMN
    Thanks
    V Kumar

    Even I had raised a SR on this in October 2008. But didn't get any solution for a long time, finally I had removed the identity column from the table. I can't to that now :).
    I am using 10.1.3.3.0 and MS SQL SERVER 2005, They said it is working for MS SQL SERVER TABLE, if the identity column is not a primary key and asked me to refer to note 744735.1.
    I had followed that note, but still it is not working for me.
    But my requirement is it should work for a MS SQL SERVER 2005 table, which has identity column as primary key.
    Thanks
    V Kumar

  • Insert missing records dynamically in SQL Server 2008 R2

    Hi, I am working on a requirement where I will have to work on some % calculations for 2 different states where we do business. The task that I am trying to accomplish is technically we need to have any Product sales in both the states if not for instance
    in the following example ProductC does not have sales in OR so I need to insert a record for ProductC - OR with 0. This is an intermediary resultset of all the calculations that I am working with.
    Example Dataset:
    CREATE TABLE [dbo].[Product](
    [Product] [varchar](18) NOT NULL,
    [State] [varchar](5) NOT NULL,
    [Area1] [int] NOT NULL,
    [Area2] [int] NOT NULL,
    [Area3] [int] NOT NULL,
    [Area4] [int] NOT NULL,
    [Area5] [int] NOT NULL,
    [Area6] [int] NOT NULL,
    [Area7] [int] NOT NULL,
    [Area8] [int] NOT NULL,
    [Area9] [int] NOT NULL,
    [Area10] [int] NOT NULL,
    [Total] [int] NULL
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','OR',0,0,2,0,2,0,0,0,0,0,4)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','WA',0,0,1,0,0,0,0,0,0,0,1)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','Total',0,0,3,0,2,0,0,0,0,0,5)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','OR',0,0,5,0,0,0,0,0,0,0,5)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','WA',0,0,2,0,0,1,0,0,0,0,3)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','Total',0,0,7,0,0,1,0,0,0,0,8)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','WA',0,0,0,0,0,0,0,0,0,1,1)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','Total',0,0,0,0,0,0,0,0,0,1,1)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','OR',5,2,451,154,43,1,0,0,0,0,656)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','WA',0,20,102,182,58,36,0,1,0,0,399)
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','Total',5,22,553,336,101,37,0,1,0,0,1055)
    How to accomplish this in SQL Server 2008 R2.
    Insert missing record:
    INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','OR',0,0,0,0,0,0,0,0,0,0,0)
    Thanks in advance......
    Ione

    CREATE TABLE [dbo].[Products](
    [Product] [varchar](18) NOT NULL,
    [State] [varchar](5) NOT NULL,
    [Area1] [int] NOT NULL,
    [Area2] [int] NOT NULL,
    [Area3] [int] NOT NULL,
    [Area4] [int] NOT NULL,
    [Area5] [int] NOT NULL,
    [Area6] [int] NOT NULL,
    [Area7] [int] NOT NULL,
    [Area8] [int] NOT NULL,
    [Area9] [int] NOT NULL,
    [Area10] [int] NOT NULL,
    [Total] [int] NULL
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','OR',0,0,2,0,2,0,0,0,0,0,4)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','WA',0,0,1,0,0,0,0,0,0,0,1)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','Total',0,0,3,0,2,0,0,0,0,0,5)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','OR',0,0,5,0,0,0,0,0,0,0,5)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','WA',0,0,2,0,0,1,0,0,0,0,3)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','Total',0,0,7,0,0,1,0,0,0,0,8)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','WA',0,0,0,0,0,0,0,0,0,1,1)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','Total',0,0,0,0,0,0,0,0,0,1,1)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','OR',5,2,451,154,43,1,0,0,0,0,656)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','WA',0,20,102,182,58,36,0,1,0,0,399)
    INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','Total',5,22,553,336,101,37,0,1,0,0,1055)
    ;WIth mycte as (
    Select Product,State From (Select distinct Product from Products) p, (
    Select distinct State from Products) s
    Insert into [Products](Product,State,[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])
    Select m.Product,m.State
    ,0,0,0,0,0,0,0,0,0,0,0
    from mycte m Left Join Products p on m.[Product]=p.Product and m.State=p.State
    WHERE p.Product is null and p.State is null
    select * from Products
    Order by Product
    ,Case when State='Total' Then 2 else 1 End
    Drop table Products

  • Sql server bulk insert blob filename parameter

    My problem SQL script:
    declare @filepath varchar(100)
    set @filepath = 'E:\foto\1.jpg'
    INSERT INTO [dbo].[MsQuestions] ([TestCategoryID], [LevelID], [TestTypeID], [QuestionText], [QuestionImg])
    select  1 , 1, 8, 'data gambar',BulkColumn FROM OPENROWSET(BULK   @filepath , SINGLE_BLOB)
    thanks.
    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %>
    <%
    string sConn = @"server=.; database=OnlineTesting; Integrated Security=True";
    SqlConnection objConn = new SqlConnection(sConn);
    objConn.Open();
    string sTSQL = "exec sp_filenamea";
    SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
    objCmd.CommandType = CommandType.Text;
    SqlDataReader dr = objCmd.ExecuteReader();
    dr.Read();
    Response.BinaryWrite((byte[])dr["QuestionImg"]);
    objConn.Close();
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title>Exec SP</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
    </body>
    </html>

    Perhaps this 
    http://dimantdatabasesolutions.blogspot.co.il/2009/05/how-to-uploadmodify-more-than-one-blob.html
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How can I read file from filepath and Insert in to SQL Server ?

    Hi,
    I have table called "table1" and has data like this ..
    id
    Folder
    FileName
    1
       f:\cfs\O\
    ENDTINS5090.tif

    D:\Grant\
    CLMDOC.doc
    3
     f:\cfs\Team\
    CORRES_3526.msg
    4
      f:\cfs\S\
    OTH_001.PDF
    I have another table called "table2" with content column is image datatype.
    Id
    FileName
    Content
    1
    FileName
    2
    ENDTINS5090.tif
    3
    CLMDOC.doc
    4
    CORRES_3526.msg
    5
    OTH_001.PDF
    I would like to insert in to content column in the table2 by reading the file from filepath( table1).
    Is there any simple way or SSIS  able to do it ?
    Please help me on this.
    Thank you.

    http://dimantdatabasesolutions.blogspot.co.il/2009/05/how-to-uploadmodify-more-than-one-blob.html
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to Select from Oracle 8i database and insert into Sql Server 2005 datab

    Hi how to Select from Oracle 8i and insert into Sql Server 2005.
    Source db as Oracle 8i
    Target db as Sql Server 2005.
    I need to select one table data from Oracle 8i & insert into Sql Server 2005
    Thanks

    Thanks Khan..
    Is there is any query (OPENQUERY) available for that?
    Regards..

  • Insert data into oracle based on sql server data(here sql server acting as source to oracle and destination to oracle)

    Source is Oralce. Destination is SQL Server.
    Requirement - I have to fetch sql server server data (empid's) based emp table  and send this as input data to oracle to fetch and empid's are common.
    I cannot use merge or loopkup or for each as oracle have too many records.
    For example - In MS SQL - i have empid=1,2..Only these records, I have to fetch from oracle source into sql server destination. For this, I have adopted the below approaches...The major problem I face, when i build a empid's as a string, it is taking only
    4000 chars. My string lenght is 10000. How do I breakup this string lengh and send to data flow task till all broken strings length passed to DFT.
    Approach-1
    created two variables - oraquery string, empid string
    step1 - ms sql database - created sql task - declare @empid varchar(max)
    SELECT @empid=
    Stuff((SELECT ',' + empid
            FROM  
            (SELECT  DISTINCT  convert(varchar(10),empid ) empid FROM emp
             ) x
            For XML PATH ('')),1,1,'')
    select @empid =    '(' +  @empid + ')'
    select @empid
    resultset=singlerow
    resultset=resultname=0; variablename=User::empid (empid is declared as string)
    step2 - oracle database - created data flow task
    created oledb source
    I put  this statemnt in oraquery expression - "select * from dept where dept in  "
    +  @[User::empid] + "
    expression=true
    [OLE DB Source [1]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.
    An OLE DB record is available.  Source: "Microsoft OLE DB Provider for Oracle"  Hresult: 0x80040E14  Description: "ORA-00936: missing expression".
    Approach-2
    created three variables - oraquery string, empid  int, loop object--when I put int then it is automatically setting to 0
    step1 - ms sql database - created sql task - SELECT  DISTINCT  convert(varchar(10),empid ) empid FROM emp
    resultset=fullresult
    resultset=resultname=0; variablename=User::loop
    step2 - created a for each loop container
    for loop editor - for each ado ennumerator
    enumerator configuration - loop
    variablemapping - variable=empid;index=0
    step3 - oracle database - created data flow task (outside for each loop. If I put inside it is taking long time)
    created oledb source
    I put  this statemnt in oraquery expression - "select * from dept where dept in  "
    +  @[User::empid] + "
    expression=true
    Data inserting in a destination table but  empid=0.

    Sorry didnt understand if your step3 is outside loop how
    @[User::empid] will get values for the empids from User::loop. The iteration happens inside loop so you
    need to have a logic to form the delimited list inside using a script task or something and concatenating everything and storing to variable @[User::empid]
    . Then only it will have full value used to be used in step3 query
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • IMovie Clip Speed Issue! Please Help!

    Hey Guys. I have been having a weird issue with iMovie '09. Here are my current iMovie and computer specs. IMovie '09 - Version 8.0.6 (821) Latest Update *Running on:* Macbook 5,1 (Latest Updates) Mac OS X 10.5.8 Processor - 2.4 GHz Intel Core 2 Duo

  • How do I restore a Mac Mini 1.83?

    Hey there, I was just given two Mac Mini 2006 1.83ghz the other day (old, out of use office computers) and one powers on and works perfectly, the other tells me its has a boot error and to insert boot disc. My issue with the first one is that because

  • ABAP HR Reports

    Hi Experts, i'm new to HR reporting, Now My Requirement is to add 16 more fields to existing report . Transaction for that report is S_PH9_46000434. for doing this ,wht is the approch to follow. explaine me in detail please. The program being RHXTEIL

  • What is the command to create a jar file through Command Promt?

    Hi, I done my java project. Now i need to create a exe or jar file to fully complete it. I decided to create a jar file. Because, It'll support both PC and MAC. I exported my JAR file through eclipse. But that jar file loads without images and icons

  • TS2570 I've tried everything here...

    Hello! I've tried everything here, but when I turn my Mac Mini on it still goes to the gray screen with a loading wheel, then after 1-2 minutes it shuts its self off. Its running OS X 10.5.8. Anybody have any ideas about what I can do?