Hi,
I have a table function with a table as return value.
For example:
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.
I have a table function with a table as return value.
For example:
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 GOWhen 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.