Create a table in SQL with datatype equivalent to LongBlob

I have a mySQL or phpMyadmin table (nor sure) (with longblob fields) that I want to convert to SQL Server.
Here is a link to a Rar with two files, the 'ORIGINAL CODE.sql' is the original code sample and the 'NEW_SQL_CODE.sql' is the code I am writing in SQL to create a database.
Click to download the two files.
I fail to make the insert in the 'NEW_SQL_CODE.sql', it says (translated from spanish) something like "The binary data will be truncated"
INSERT INTO inmuebles_fotos (ci_inm, pos, foto, mini, comentario, inet, impr_cartel, impr_visita) VALUES
(6, 0, 0xffd8ffe000104a46494600010100000100010...etc...
I don’t know how if I have defined the wrong data type (image) equivalent to the MySQL LongBlob. All I want to do is to make that insert in SQL and save that image as jpg if possible. I don't know if it's not posible in SQL and can only
be done in MySQL.
Thanks for any help.

The original table is not mine; I am just trying to save the images as .jpg in hard drive.
Here is the original table I have that has 500Mb in pictures, in the sample there is only 1 picture:
CREATE TABLE IF NOT EXISTS `inmuebles_fotos` (
`ci_inm` int(10) unsigned DEFAULT NULL,
`pos` smallint(6) DEFAULT NULL,
`foto` longblob,
`mini` longblob,
`comentario` varchar(100) DEFAULT NULL,
`inet` tinyint(3) unsigned DEFAULT '0',
`impr_cartel` smallint(6) DEFAULT '0',
`impr_visita` smallint(6) DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
And here is the equivalent table in SQL that I am trying to create to import al registers so I can save the pictures from SQL Server that is what we use here.
CREATE TABLE [dbo].[inmuebles_fotos2](
[ci_inm] [int] NULL,
[pos] [int] NULL,
[foto] [image] NULL,
[mini] [image] NULL,
[comentario] [varchar](1) NULL,
[inet] [int] NULL,
[impr_cartel] [int] NULL,
[impr_visita] [int] NULL
Sorry for the trouble, I am trying everything I get my hands on until I get to save those images in “0x1234567890ABCDE…….” Format.
I'll try anything you sugest me but I have only use SQL Server so that's why I'm trying this road first.
Thanks for your help.

Similar Messages

  • Create oracle table from sql server

    Dear Gurus,
    I need to create some tables from sql server 2008 to a oracle 11g database. Some tables contain vbinary datatype. Now my queries are
    1. How can I do that?
    2. If DB link is a solution then would you please provide me a step by step process to do so?
    3. Is there any issue with datatype?
    SQL Server db is on windows 2008 R2
    Oracle is in RHEL 5.5
    Will appreciate ur help.

    well suppose i generate flat files from sql server and load in oracle by sqlloader then will there be any issue with vbinary datatype? what should be the equivalent data type in oracle table?

  • Need To Create a table in Sql Server and do some culculation into the table from Oracle and Sql

    Hello All,
    I'm moving a data from Oracle to Sql Server with ETL (80 tables with data) and i want to track the number of records that i moving on the daily basis , so i need to create a table in SQL Server, wilth 4 columns , Table name, OracleRowsCount, SqlRowCount,
    and Diff(OracleRowsCount - SqlRowCount) that will tell me the each table how many rows i have in Oracle, how many rows i have in SQL after ETL load, and different between them, something like that:
    Table Name  OracleRowsCount   SqlRowCount  Diff
    Customer                150                 150            
    0
    Sales                      2000                1998          
    2
    Devisions                 5                       5             
    0
    (I can add alot of SQL Tasks and variables per each table but it not seems logicly to do that, i tryid to find a way to deal with that in vb but i didn't find)
    What the simplest way to do it ?
    Thank you
    Best Regards
    Daniel

    Hi Daniel,
    According to your description, what you want is an indicator to show whether all the rows are inserted to the destination table. To achieve your goal, you can add a Row Count Transformation following the OLE DB Destination, and redirect bad rows to the Row
    Count Transformation. This way, we can get the count of the bad rows without redirecting these rows. Since the row count value is stored in a variable, we can create another string type variable to retrieve the row count value from the variable used by the
    Row Count Transformation, and then use a Send Mail Task to send the row count value in an email message body. You can also insert the row count value to the SQL Server table through Execute SQL Task. Then, you can check whether bad rows were generated in the
    package by querying this table.  
    Regards,
    Mike Yin
    TechNet Community Support

  • Create temporary Tables using SQL

    Hello,
    I'm wondering if SAP allows the creation of new Tables without SDK objects,
    I want to create temporary tables using SQL scripts an compile them when an specific addon is connected and erase them when the addon disconnects,
    Do you think this is allowed?.
    thanks,
    Gabriela

    You could always have a second DB to create your temp tables in.  This is the way I've done this, as well as created my own views and stored procedures in it.  No updating of the primary table necessary.  The way I named things was:
    Company_DB - Company Database
    Company_DB-Extern - My own stuff
    Then, in sap, you can just do [Company_DB-Extern]..Object to call it, or you do the same from withing your project.

  • Need Guide to create a table in SQL Server and Process data for JDBC

    Dear All,
    Scenario:JDBC to JDBC
    I need to practice JDBC to JDBC scenario and for that i need to create a table in SQL server for sender ,receiver and update  i have installed SQL Server and no idea about creation of table and Connection string for PI.
    I want you to explain each and every step for the Table Creation ,Driver and connection string.
    Thanks in Advance.

    Try searchin in the forum and then google. This forum is not for teaching the basics.
    VJ

  • How to create labeled table of Content with expand and collapse

    Hi All,
    Can somebody help me how to create labeled table of Content with expand and collapse as example given below:
    User1
    Template1
    Template2
    User2
    +
    User3
    Template1
    Template2
    Like when we see expand (+) and collapse (-) button when we click on 'about this page' link.
    Thanks
    Bhupendra

    Hi,
    Tou can use Table inside table to show the details this way but I'm not sure about Expand/Collapse.
    Expand/Collapse are part of HGRID.
    I think we can develop this functionality with little manipulation.
    Regards,
    Reetesh Sharma
    Edited by: Reetesh Sharma on Jun 28, 2010 4:56 AM

  • Create a table in SQL Server, Export tables from Microsoft Excel to Microsoft SQL Server, Populate the created table

    Hello team,
    I have a project that I need to do, what is the best approach for each step?
    1- I have to create a table in Microsoft SQL Server.
    2- I have to import data/ tables from Microsoft Excel or Access to Microsoft SQL Server. Should I use Microsoft Visual Studio to move data from Excel or Access?
    3-I should populate the created table with the data from the exported data.
    4-How should I add the second and third imported table to the first table? Should I use union query?
    After I learn these, I will bring up the code to make sure what I do is right.
    Thanks for all,
    Guity
    GGGGGNNNNN

    Hello Naomi,
    I have imported all the tables into SQL Server,
    I created a table:
    CREATE
    TABLE dbo.Orders
    Now I want to populate this table with the values from imported tables, will this code take care of this task?
    INSERT INTO dbo.Orders(OrderId, OrderDate)
    SELECT OrderId, OrderDate
    FROM Sales.Orders
    UNION
    SELECT OrderId, OrderDate
    FROM Sales.Orders1
    Union
    SELECT OrderId, OrderDate
    FROM Sales.Orders2
    If not, what is the code?
    Please advise me.
    GGGGGNNNNN
    GGGGGNNNNN

  • How to Create a Table in Oracle with XML data type.

    Dear ALL,
    What are the requirements for creating a table with xml datatype in Oracle: The steps would help very much to know the scripting of the table and how to query and either insert/update and remove data from that table.
    Any help, direction, advise would be highly appreciated.
    Thanks.

    Reffer to this Note.243554.1.
    In a nut shell you will need to run catqm.sql

  • Unable to create a table in cloudscape with solaris

    Hi experts,
    I have WLS6.1 running on Solaris. I'm trying to create tables in cloudscape but
    it throughs NullPointerException. I'm able to run java utils.Schema jdbc:cloudscape:test;create=true
    COM.cloudscape.core.JDBCDriver
    -verbose test.ddl
    This is the error :
    CREATE TABLE test ( id varchar(32), name varchar(32))
    SQL Exception: Java exception: ': java.lang.NullPointerException'.
    SQL Error Code: 0
    SQL State: XJ001
    It creates empty database. I have the required permission. And I can run java
    COM.cloudscape.tools.cview but when I try to create a table even using cview it
    throughs NullPointerException.
    Any help is appreciated.

    Try this SQL statement:
    CREATE TABLE myTable (myField COUNTER)
    This creates a table with name 'myTable' and a column 'myField' of type AutoNumber.

  • Question about creating new tables using SQL script in WebLogic Server

    Hi,
    I am new to WebLogic and I am following a book Java EE Development with Eclipse published by PACKT Publishing to learn
    Java EE.  I have installed Oracle Enterprise Pack for Eclipse on the PC and I am able to log into the WebLogic Server Administration Console
    and set up a Data Source.  However the next step is to create tables for the database.  The book says that the tables can be created using
    SQL script run from the SQL command line.
    I cannot see any way of inputting SQL script into the WebLogic Server Admistration Console.  Aslo there is no SQL Command line in DOS.
    Thanks  for your help.
    Brian.

    Sounds like you are to run the scripts provided by a tutorial to create the tables, right?  In that case, you may need to install an Oracle client to connect to your database.  The client is automatically installed with the database, so if you have access to the server that hosts the database, you should be able to run SQLplus from there.
    As far as I know, there is no way to run a script from the Admin Console.  I could be wrong, however.

  • How to dynamically create a table to join with

    I have a table of users and when they should submit time sheets: start date and end date.
    I have a table of timesheets with user ID and week-ending date.
    I need to construct a report of which timesheets are missing this year.
    I effectively need a table of week-ending dates for the year to join with the user and table and filter on start/end dates - and derive a list of week-ending dates for which I expect to see timesheets.
    But I donu2019t have write-access to the database: Can I effectively create a local table with the week-ending dates for the year?
    We currently solve it by using a local Excel file. Is that the most efficient way? It is also a nuisance as we have to edit the report and copy the excel file when we move directories.
    2nd question on the forum
    Mike

    Mikecro,
    Trying to actually write a SQL script of any complexity in the Command window itself is a horrible experience. I'd recommend writing your SQL in SSMS and testing it there. Once you have the script written in SSMS and it producing the desired result set you can then copy and paste it into the CR Command. (Just use hard coded dummy parameters in SSMS and replace them once they're pasted into the command.)
    If you are building "canned" reports that will ship with a software package, I'd recommend building it out as a stored procedure (and the same with any other reports). This will also make future support much easier by allowing you to make any modifications to the data set directly on the SQL Server without having to touch CR or CRS.
    If you're acting as a 3rd party consultant and you don't have the access or authority to add SP objects to the SQL Server then sticking with the Command is going to be your best bet. This is still better than using linked tables IMO.
    #1) CR simply lacks the ability to write SQL with any real level of complexity. It can't even create a simple sub-query.
    #2) It looks more professional. From an end users pov a report that uses a sql command, as opposed to linked table, demonstrates that the report developer is of a more advance skill level.
    #3) Most of your clients won't know how to write SQL themselves so they will need to re-engage your services to take care of any existing reports and to build new ones. It's easier to get repeat business than it is to get new business.
    As you've already seen, getting everything into a single, well written, SQL command can make a dramatic improvement in report performance. If you get in the habit of building all of your reports using SPs, Views or Commands, you'll quickly come to appreciate added flexibility it affords you. Once to modify your report building workflows to accommodate the change, you won't even think about going back.
    HTH,
    Jason

  • Creating Temperory Table For SQL Performance.

    Hi,
    I have a SQL query,
    SELECT NVL(SUM(S.STDY_EFFORTS * K.PERCENTAGE_VALUE / 100), 0)
    FROM effort_t S, FULL OUTER JOIN role_dtls_t K
    ON S.DEAL_DETAIL_ID = K.DEAL_DETAIL_ID
    AND S.TOWER_ID = S.TOWER_ID
    AND S.SUBTOWER_ID = K.SUBTOWER_ID
    AND S.LOCATION_ID = K.LOCATION_ID
    AND S.CLIENT_ROLE_ID = K.CLIENT_ROLE_ID
    AND S.CLIENT_ROLE_ID = :B2
    AND S.EMP_CATEGORY_ID = :B1
    AND S.EMP_CATEGORY_ID = K.EMP_CATEGORY_ID
    AND S.STATE_ID = K.STATE_ID
    AND S.YEAR_NO = K.YEAR_NO
    WHERE K.DESIGNATION_ID IN
    (SELECT D.DESIGNATION_ID
    FROM PRC_VNDR_DESGN_TYPE_MSTR_T D
    WHERE D.DESIGNATION_ID = K.DESIGNATION_ID
    AND D.SENIORITY_FLAG = 'N')
    AND S.DEAL_DETAIL_ID = :B7
    AND S.TOWER_ID = :B6
    AND S.SUBTOWER_ID = NVL(:B5, S.SUBTOWER_ID)
    AND S.LOCATION_ID = NVL(:B4, S.LOCATION_ID)
    AND S.YEAR_NO = :B3
    GROUP BY S.DEAL_DETAIL_ID, S.TOWER_ID, S.YEAR_NO
    My effort_t table is having huge data thats y this query is taking lot of time to execute.Due to thIS performance issue Can I create temperory tableS on this two tables effort_t and role_dtls_t .
    If Icreate a temperory table how i get data from this two tables in to the temperory tables.
    Thanks

    Fasy wrote:
    My effort_t table is having huge data thats y this query is taking lot of time to execute.Due to thIS performance issue Can I create temperory tableS on this two tables effort_t and role_dtls_t .
    If Icreate a temperory table how i get data from this two tables in to the temperory tables.
    ThanksCreating a temporary table is most likely not going to increase performance to be honest. Your best bet would be to tune your query. See the following thread:
    {message:id=9360003}

  • How do I create a table of contents with a nested style paragraph?

    I'm having difficulty figuring out how to generate my Table of Contents with a nested style. In this screen shot, "SPECIAL EVENTS" is considered level one and the pink circled "Fittest Firm Challenge" is level 2. Because it is a nested style, it is picking up the entire paragraph. I don't want to put in a paragraph break because that would add too much space in the magazine since there are a lot of other listings like this. I've tried reading through other people's discussions but I'm totally lost with the explanations. Is there a simple workaround or solution to this?

    apricotanna wrote:
    I'm having difficulty figuring out how to generate my Table of Contents with a nested style. In this screen shot, "SPECIAL EVENTS" is considered level one and the pink circled "Fittest Firm Challenge" is level 2. Because it is a nested style, it is picking up the entire paragraph. I don't want to put in a paragraph break because that would add too much space in the magazine since there are a lot of other listings like this. I've tried reading through other people's discussions but I'm totally lost with the explanations. Is there a simple workaround or solution to this?
    You're asking InDesign to do something it's not designed to do, namely, to treat a nested-style section of a paragraph as an independent paragraph. That's called a "run-in paragraph" in Adobe FrameMaker, and it's been a beloved feature there since FrameMaker was introduced in '89, about ten years before InDesign.
    You can make a formal feature enhancement request here: Wishform Many InDesign features have come into being from user requests, so lend your voice, and be patient. Explain why you think a run-in paragraph feature would be useful.
    Others have asked about this, and there are a number of workarounds that may or may not be suitable for you. Let's hope that some of the more-intense forum folks can help you with a useful search term for this forum, so that you can review what's been suggested and tried in the past, and what results you can expect.
    In the meantime, you might consider inserting the second-level heading in an inline anchored text frame in the paragraph. It will be an independent paragraph but you can adjust appear on the same line as following paragraph. Then you can extract it for the TOC.
    Here's an example:
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • ORA-00942 when creating external table under 10g with AQ

    I have an application that runs with AQ. The front-end queues up batch-type
    tasks in a queue. When one particular kind of message is dequeued, it
    initiates a data load. That load requires the creation of an external
    table.
    The schema in question is owned by user BL (bulkload). The queue
    is owned by BLB (bulkload batch), primarily to simplify some of the
    rules needed by the resource manager in order to limit the total CPU
    a batch process can consume. The BLB user has full access to the
    BL schema, along with the following rights:
    CREATE TYPE
    CREATE TABLE
    CREATE SEQUENCE
    CREATE PROCEDURE
    CREATE VIEW
    CREATE SYNONYM
    CREATE SEQUENCE
    ALTER SESSION
    CREATE SESSION
    QUERY REWRITE
    CREATE ANY CONTEXT
    EXECUTE_CATALOG_ROLE
    CREATE MATERIALIZED VIEW
    CREATE ANY DIRECTORY
    DROP ANY DIRECTORY
    The table creation works fine under 9.2.0.8 (our current required
    version). However the application generates an ORA-00942 table or view does
    not exist when run under 10g (10.2.0.1 and 10.2.0.3).
    The following statement is the problem:
    CREATE TABLE bulkload33 (
              field1 VARCHAR2(2000),field2 VARCHAR2(2000),field3 VARCHAR2(2000))
              ORGANIZATION EXTERNAL (
              TYPE oracle_loader DEFAULT DIRECTORY EXT_100
              ACCESS PARAMETERS ( RECORDS DELIMITED BY "\r\n"
              CHARACTERSET 'WE8ISO8859P1'
              BADFILE EXT_100:'bulkload_bad.csv'
              LOGFILE EXT_100:'bulkload_log.csv'
              FIELDS TERMINATED BY ','
              OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES ARE NULL REJECT ROWS WITH ALL NULL FIELDS (
              field1 CHAR(2000),field2 CHAR(2000),field3 CHAR(2000),field4 CHAR(2000)))
              LOCATION ('bulkload.csv')
              ) REJECT LIMIT UNLIMITED PARALLEL;
    To clarify, the preceding statement, when handled by the process
    for a queue message, failes with an ORA-00942.
    Note that I can issue the command directly, as BLB or SYS, against
    the BL schema with no problems. Further, as user BLB or SYS, I can do
    the following:
    CREATE OR REPLACE PROCEDURE dotest
    IS
         l_sql varchar2(2000);
    BEGIN
         l_sql := 'CREATE TABLE bulkload33 (
              field1 VARCHAR2(2000),field2 VARCHAR2(2000),field3 VARCHAR2(2000))
              ORGANIZATION EXTERNAL (
              TYPE oracle_loader DEFAULT DIRECTORY EXT_100
              ACCESS PARAMETERS ( RECORDS DELIMITED BY "\r\n"
              CHARACTERSET ''WE8ISO8859P1''
              BADFILE EXT_100:''bulkload_bad.csv''
              LOGFILE EXT_100:''bulkload_log.csv''
              FIELDS TERMINATED BY '',''
              OPTIONALLY ENCLOSED BY ''"'' MISSING FIELD VALUES ARE NULL REJECT ROWS WITH ALL NULL FIELDS (
              field1 CHAR(2000),field2 CHAR(2000),field3 CHAR(2000),field4 CHAR(2000)))
              LOCATION (''bulkload.csv'')
              ) REJECT LIMIT UNLIMITED PARALLEL';
         EXECUTE IMMEDIATE l_sql;
    END;
    show errors
    EXEC dotest
    Does anyone have any ideas of why this doesn't work under 10g? Metalink
    has yielded no clues so far.
    Thanks.

    Define "has full access to the BL schema" given that it is impossible to grant access rights, in Oracle, by schema. What was done and how was it done?
    My guess is that the privs were granted in a role, rather than explicitly, as is required for PL/SQL.

  • How to create updateable resultset using sql with "order by"

    Dear all,
    I'm using the Derby database to hold a table of stock prices. After the table is populated, I want to do some calculations and store the result in a column.
    I get the resultset using the following code
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery(select history_id, value, days from history where ticker = '" + ticker + "' order by value_date"); {code} When I then try to update the "days" field, I get an SQLException telling me that the resultset is not updatable. However, if I remove the "order by" clause, I am able to update the data, but then my algorithm does not work as I need to traverse the data in a specific order. The quesion is: how do I create an updatable resultset using a sql-statement with an order by clause? Kind regards Karl Martin Lund                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    jschell wrote:
    Seems rather obvious to me that the exception specifically tells you that you can't do that.OP: I would guess it's because ORDER BY forces the database to read all the result rows into a temporary area, sort them, and then return them from this temporary area, as opposed to streaming the results. The extra step probably makes updateable result sets more difficult (or maybe not possible), so they opted not to do it.

Maybe you are looking for

  • Bluetooth Keyboard with PC & Mac at the same time.

    Dear Forum. I have: 1 Macbook Pro 1 PC Laptop 1 Apple Bluetooth Keyboard 1 HD Display which both run through on separate cables. The keyboard is able to connect to both with no problem but to do this involves sleeping the PC and tuning on bluetooth o

  • Missing drivers PCI\VEN_1180--..please help

    Missing drivers PCI\VEN_1180--..Help!!!! After upgrading to Windows 8.1 from Vista: I am missing the following drivers for Base System Device here is the information for the driver. I am unable to use my Built in Camera, CD/ROM Drive, System speakers

  • Flashback Recovery area in Oracle 10g

    Hi, our db_recovery_file_dest_size = 4G after this is filled, when i am logging in as a user, archiver error ORA-00257 has occured. I want to avoid this error coming every time, is there any way to automatically delete some of the files when it (db_r

  • What display settings do i need to change to use hdmi cable with macbook pro

    what display settings do i need to change to what tv and display my macbook pro with hdmi cable connected to computer.

  • Srclib.api not created in PAR file

    I updated a bundle file with Labels for Commands for KM the problem is on compiling it the needed srclib.api in the par file is not created. Thus when you go to KM to view the Properties they don't have the labels. Naturally because it can't find the