日期:2014-05-18  浏览次数:20656 次

优化一个SQL代码

建表语句如下
CREATE TABLE [dbo].[D_typeParaMapping](
[Id] [int] IDENTITY(1,1) NOT NULL,
[productTypeId] [smallint] NOT NULL,
[P1Name] [varchar](50) NULL,
[p2Name] [varchar](50) NULL,
[p3Name] [varchar](50) NULL,
[p4Name] [varchar](50) NULL,
[p5Name] [varchar](50) NULL,
[p6Name] [varchar](50) NULL,
[p7Name] [varchar](50) NULL,
[p8Name] [varchar](50) NULL,
[p9Name] [varchar](50) NULL,
[p10Name] [varchar](50) NULL,
[p11Name] [varchar](50) NULL,
[p12Name] [varchar](50) NULL,
[p13Name] [varchar](50) NULL,
[p14Name] [varchar](50) NULL,
[p15Name] [varchar](50) NULL,
[p16Name] [varchar](50) NULL,
[p17Name] [varchar](50) NULL,
[p18Name] [varchar](50) NULL,
[p19Name] [varchar](50) NULL,
[p20Name] [varchar](50) NULL,
[p21Name] [varchar](50) NULL,
[p22Name] [varchar](50) NULL,
[p23Name] [varchar](50) NULL,
[p24Name] [varchar](50) NULL,
[p25Name] [varchar](50) NULL,
[p26Name] [varchar](50) NULL,
[p27Name] [varchar](50) NULL,
[p28Name] [varchar](50) NULL,
[p29Name] [varchar](50) NULL,
[p30Name] [varchar](50) NULL,
[p31Name] [varchar](50) NULL,
[p32Name] [varchar](50) NULL,
[p33Name] [varchar](50) NULL,
[p34Name] [varchar](50) NULL,
[p35Name] [varchar](50) NULL,
[p36Name] [varchar](50) NULL,
[p37Name] [varchar](50) NULL,
[p38Name] [varchar](50) NULL,
[p39Name] [varchar](50) NULL,
[p40Name] [varchar](50) NULL,
[P41Name] [varchar](50) NULL,
[p42Name] [varchar](50) NULL,
[p43Name] [varchar](50) NULL,
[p44Name] [varchar](50) NULL,
[p45Name] [varchar](50) NULL,
[p46Name] [varchar](50) NULL,
[p47Name] [varchar](50) NULL,
[P48Name] [varchar](50) NULL,
[p49Name] [varchar](50) NULL,
[p50Name] [varchar](50) NULL,
[p51Name] [varchar](50) NULL,
[p52Name] [varchar](50) NULL,
[p53Name] [varchar](50) NULL,
[p54Name] [varchar](50) NULL,
[p55Name] [varchar](50) NULL,
[p56Name] [varchar](50) NULL,
[p57Name] [varchar](50) NULL,
[p58Name] [varchar](50) NULL,
[p59Name] [varchar](50) NULL,
[p60Name] [varchar](50) NULL,
[p61Name] [varchar](50) NULL,
[p62Name] [varchar](50) NULL,
[p63Name] [varchar](50) NULL,
[p64Name] [varchar](50) NULL,
[p65Name] [varchar](50) NULL,
[p66Name] [varchar](50) NULL,
[p67Name] [varchar](50) NULL,
[p68Name] [varchar](50) NULL,
[p69Name] [varchar](50) NULL,
[p70Name] [varchar](50) NULL,
[f1Name] [varchar](50) NULL,
[f2Name] [varchar](50) NULL,
[f3Name] [varchar](50) NULL,
[f4Name] [varchar](50) NULL,
[f5Name] [varchar](50) NULL,
[p71Name] [varchar](50) NULL,
[p72Name] [varchar](50) NULL,
[p73Name] [varchar](50) NULL,
[p74Name] [varchar](50) NULL,
[p75Name] [varchar](50) NULL,
[p76Name] [varchar](50) NULL,
[p77Name] [varchar](50) NULL,
[p78Name] [varchar](50) NULL,
[p79Name] [varchar](50) NULL,
[p80Name] [varchar](50) NULL,
[p81Name] [varchar](50) NULL,
[p82Name] [varchar](50) NULL,
[p83Name] [varchar](50) NULL,
[p84Name] [varchar](50) NULL,
[p85Name] [varchar](50) NULL,
[p86Name] [varchar](50) NULL,
[p87Name] [varchar](50) NULL,
[p88Name] [varchar](50) NULL,
[p89Name] [varchar](50) NULL,
[p90Name] [varchar](50) NULL,
[p91Name] [varchar](50) NULL,
[p92Name] [varchar](50) NULL,
[p93Name] [varchar](50) NULL,
[p94Name] [varchar](50) NULL,
[p95Name] [varchar](50) NULL,
[p96Name] [varchar](50) NULL,
[p97Name] [varchar](50) NULL,
[p98Name] [varchar](50) NULL,
[p99Name] [varchar](50) NULL,
[p100Name] [varchar](50) NULL,
[p101Name] [varchar](50) NULL,
[p102Name] [varchar](50) NULL,