Red Gate forums :: View topic - INSERT INTO ... doesn't return the correct column order
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Prompt 5 EAP
SQL Prompt 5 EAP forum

INSERT INTO ... doesn't return the correct column order

Search in SQL Prompt 5 EAP forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
TSchwab



Joined: 11 Jan 2008
Posts: 62
Location: Germany

PostPosted: Tue Dec 14, 2010 11:22 am    Post subject: INSERT INTO ... doesn't return the correct column order Reply with quote

Hi,

I have a table function with a table as return value.
For example:

Code:

CREATE FUNCTION [dbo].[GetAddress] (
)
RETURNS @Result TABLE (
    _ID INT
    , LastName NVARCHAR(MAX)
    , FirstName NVARCHAR(MAX)
    , ZIPCode NVARCHAR(100)
)
AS
BEGIN

    INSERT INTO @Result
            (LastName
           , [_ID]
           , ZIPCode
           , FirstName)
    VALUES  ( -- LastName
     -- _ID
     -- ZIPCode
     -- FirstName
             )

END
GO
 


When I type the INSERT INTO the SQL-Prompt returns the columns in the wrong order!
Rolling Eyes

It works when the table is created with a DECLARE statement.
_________________
Regards,

Thorsten
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group