I have a table dbo.AccountTypes with following two columns
AccountTypeId int not null
AccountTypeName varchar(50) not null
I want to add a row with values 1 and Partner's Capital A/c for the respective columns. I tried following insert command but it does not work.
insert into dbo.AccountTypes (AccountTypeId, AccountTypeName)
values (1, "Partner's Capital A/c")
Please note inverted comma in the word Partner's Capital A/c
But it fails. Any suggestions?
Answer
Replace the single quote inside the string with two single quotes, and surround the string with single quotes:
insert into dbo.AccountTypes (AccountTypeId, AccountTypeName)
values (1, 'Partner''s Capital A/c')
No comments:
Post a Comment