T-sql Via Linked server - MySQL

  • 2 things I need to...

    1 Truncate my MYSQL table via Linked server using OPENQUERY if possible.

    2 If truncate is not possible can I reseed the id field after running DELETE FROM OPENQUERY (****)

    Would prefer to truncate if possible rather than delete.

    These are performed using a linked server

  • LinkedServerName.Catalog.Schema.TableName

    What is the default schema of a 4 part qualifier name for a MYSQL table?

  • i think you can do it like this?

    EXECUTE ( 'TRUNCATE TABLE SalesTable' ) AT MyLinkedServer;

    that code example is how i can calla CREATE TABLE command at a remote, i think you can do the same for truncate.

    --create a table on the remote

    EXECUTE ( 'CREATE TABLE Sandbox.dbo.SalesTable

    (SalesID int, SalesName varchar(20)) ; ' ) AT PROD2K8;

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • You the man!!!

    Nice one worked a treat.

  • glad i could help!

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply