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

Provides intelligent code completion for SQL Server editors.

Moderators: David Atkinson, Anu Deshpande, Luke Jefferson, Paul Stephenson

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

Postby TSchwab » Tue Dec 14, 2010 11:22 am

Hi,

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

Code: Select all
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!
:roll:

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

Thorsten
TSchwab
 
Posts: 62
Joined: Fri Jan 11, 2008 9:47 am
Location: Germany

Return to SQL Prompt 5 EAP

Who is online

Users browsing this forum: No registered users and 0 guests

cron