Import Information from one table to another

  • I am using SQL Server Express Management Studio tool to work on a SQL Server database. First question I would like answered is whether or not I can download the full SQL Server Management studio with DTS services that allow me to import and export data using a Wizard or do I have to purchase a full SQL Server instance?

    We already have a SQL Server instance installed with Windows Server 2003 but I do not have the graphical user interface to go with it. Any suggestions.

    The previous situation being what it is. I would like to do the following.

    I have a table that contains some information [FieldName, FieldDesc]. This information was imported from a different database and I want to insert it into a different table and add a Foreign Key to it and a Primary ID.

    I have written the following Stored Procedure to perform the importing and inserting into the database but I think I am making an error somewhere in the code.

    Any help would be much appreciated.

    CREATE PROCEDURE [dbo].[FieldInsert]

    @FieldID int = 0,

    @FieldName nvarchar(255),

    @FDesc nvarchar(255),

    @TableID int

    AS

    BEGIN

    SET NOCOUNT ON;

    DECLARE FieldInfoCursor CURSOR FOR

    SELECT [Name], [Description]

    FROM dbo.FFDCSTBP

    OPEN FieldInfoCursor

    FETCH NEXT FROM FieldInfoCursor INTO @FieldName, @FDesc

    WHILE @@FETCH_STATUS = 0

    BEGIN

    INSERT INTO dbo.FieldTest ([FieldID], [Name], [Description], [TableID]) VALUES (@FieldID, @FieldName, @FDesc, 4)

    SET @FieldID = @FieldID + 1

    FETCH NEXT FROM FieldInfoCursor INTO @FieldName, @FDesc

    END

    CLOSE FieldInfoCursor

    DEALLOCATE FieldInfoCursor

    END

  • 🙂 Hi there...

    I'm not sure what your problems are but I'll try to help...

    for the download, try downloading SQL Management Studio 2005 express edition, that's what i'm using right now. just type it in a search engin and alakazam, theres your... SQL Management Studio 2005 express edition.

    for the insertion of data to another table, you don't need to use a cursor... (I think there are some issues found using cursors) just try this one

    INSERT INTO TableA (Col1, Col2, Col3)

    SELECT Col1, Col2, Col3

    FROM TableB

    😀 Hope it helps

    _____________________________________________
    [font="Comic Sans MS"]Quatrei Quorizawa[/font]
    :):D:P;):w00t::cool::hehe:
    MABUHAY PHILIPPINES!

    "Press any key...
    Where the heck is the any key?
    hmmm... Let's see... there's ESC, CTRL, Page Up...
    but no any key"
    - Homer Simpson

Viewing 2 posts - 1 through 1 (of 1 total)

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