1

我正在尝试查询以插入表中,但我不断收到此消息:

查询是:

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')
4

2 回答 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 语句就是这样工作的

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

放入HASHBYTES('md5', password)值部分并在列部分中命名该列

于 2012-04-18T10:58:56.060 回答
0

你的问题是这条线HASHBYTES('md5', password),你想HASHBYTESVALUES你的INSERT.

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'
)
于 2012-04-18T10:59:55.260 回答