Reputation: 6102
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')
Upvotes: 1
Views: 3593
Reputation: 247880
Your issue is with this line HASHBYTES('md5', password)
, you want to use the HASHBYTES
in the VALUES
area of your 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'
)
Upvotes: 0
Reputation: 204924
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 into table (col1, col2) values (val1, val2)
Put HASHBYTES('md5', password)
in the values part and name that column in the column part
Upvotes: 3