Click here to Skip to main content
15,909,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
This table unsorted. The "order by" is ignored in SQL 2012.
this is function
SQL
INSERT INTO @Customer
        SELECT Customer_ID, Name,
        CASE 
            WHEN Expiry_Date < GETDATE() then 1 
            WHEN Expired = 1 then 1 
            ELSE 0
            END
        from Customer **order by Name**
Posted
Updated 25-Mar-13 6:13am
v3
Comments
Sandeep Mewara 25-Mar-13 11:48am    
Which table? Please elaborate.
saeed1364 25-Mar-13 12:14pm    
whtas:
this is function

1 solution

Your syntax for INSERT statement is wrong.

A query is a SELECT one, or an INSERT one, but it can't be both.

Remove the INSERT line
 
Share this answer
 
Comments
saeed1364 25-Mar-13 12:13pm    
this is function

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900