首页 新闻 搜索 专区 学院

sqlserver 随机数问题

0
悬赏园豆:10 [待解决问题]

我写了个存储过程

ALTER  PROCEDURE [dbo].[SP_Personal_AddRandom]
    @count INT ,
    @StageID INT ,
    @PassWord NVARCHAR(50) ,
    @CreateUser INT
AS
    INSERT  INTO dbo.Personal
            ( StageID ,
              TypeID ,
              PersonalName ,
              Password ,
              CreateUser
        
            )
            ( SELECT TOP (@Count)
                        @StageID,
                        TypeID,
                        Name,
                        @PassWord,
                        @CreateUser
              FROM      dbo.SysPersonnel
              ORDER BY NEWID()
            )

消息 156,级别 15,状态 1,过程 SP_Personal_AddRandom,第 29 行
关键字 'ORDER' 附近有语法错误。 请问如何改正 

learningcom的主页 learningcom | 初学一级 | 园豆:148
提问于:2013-05-14 09:15
< >
分享
所有回答(2)
0
语法:Insert  tableName (列。。。。。)
    select  column_list  from table_source
    where  search_condition
:INSERT  INTO dbo.Personal
            ( StageID ,
              TypeID ,
              PersonalName ,
              Password ,
              CreateUser
        
            )
           SELECT TOP (@Count)
                        @StageID,
                        TypeID,
                        Name,
                        @PassWord,
                        @CreateUser
              FROM      dbo.SysPersonnel
              ORDER BY NEWID()
yyutudou | 园豆:997 (小虾三级) | 2013-05-14 10:19
0

173844862   .net高级部落

那一眼回眸 | 园豆:208 (菜鸟二级) | 2013-05-14 16:01
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册