消息102,级别15,状态1,行1'''附近的语法不正确

时间:2022-07-09 22:54:22

I am trying to query to insert in a table and i keep getting this message:

我试图查询插入表中,我不断收到此消息:

The Query is:

查询是:

INSERT INTO A_USER(PK,status,login_id,HASHBYTES('md5', password),fk_role,last_update_ts,last_update_by,created_by)
VALUES (2,1,'abc', 'abc',2,'3/15/2012 12:21:46 PM','abc','abc')

2 个解决方案

#1


0  

Your issue is with this line HASHBYTES('md5', password), you want to use the HASHBYTES in the VALUES area of your INSERT.

您的问题是使用此行HASHBYTES('md5',密码),您想在INSERT的VALUES区域中使用HASHBYTES。

INSERT INTO A_USER
(
    PK
    ,status
    ,login_id
    ,[password] -- change to the name of your column.
    ,fk_role
    ,last_update_ts
    ,last_update_by
    ,created_by
)
VALUES 
(
    2
    ,1
    , 'abc'
    ,HASHBYTES('md5', 'abc') -- place your password to be hashed where 'abc' is.
    ,2
    ,'3/15/2012 12:21:46 PM'
    ,'abc'
    ,'abc'
)

#2


3  

INSERT INTO EMP_USER(PK,status,login_id,password,fk_role,last_update_ts,last_update_by,created_by)
VALUES (2,1,HASHBYTES('md5', password),'abc','abc',2,'3/15/2012 12:21:46 PM','abc','abc')

insert statement works like that

insert语句就是这样的

insert into table (col1, col2) values (val1, val2)

Put HASHBYTES('md5', password) in the values part and name that column in the column part

将HASHBYTES('md5',密码)放在值部分中,并在列部分中命名该列

#1


0  

Your issue is with this line HASHBYTES('md5', password), you want to use the HASHBYTES in the VALUES area of your INSERT.

您的问题是使用此行HASHBYTES('md5',密码),您想在INSERT的VALUES区域中使用HASHBYTES。

INSERT INTO A_USER
(
    PK
    ,status
    ,login_id
    ,[password] -- change to the name of your column.
    ,fk_role
    ,last_update_ts
    ,last_update_by
    ,created_by
)
VALUES 
(
    2
    ,1
    , 'abc'
    ,HASHBYTES('md5', 'abc') -- place your password to be hashed where 'abc' is.
    ,2
    ,'3/15/2012 12:21:46 PM'
    ,'abc'
    ,'abc'
)

#2


3  

INSERT INTO EMP_USER(PK,status,login_id,password,fk_role,last_update_ts,last_update_by,created_by)
VALUES (2,1,HASHBYTES('md5', password),'abc','abc',2,'3/15/2012 12:21:46 PM','abc','abc')

insert statement works like that

insert语句就是这样的

insert into table (col1, col2) values (val1, val2)

Put HASHBYTES('md5', password) in the values part and name that column in the column part

将HASHBYTES('md5',密码)放在值部分中,并在列部分中命名该列