Avatar of samprg
samprg

asked on 

Insert



Hi,
I try to insert in table "pt' but gives me erro
insert into pt
        (ptid,vr,Title,TyppeID,pn)
 values (@ReportId,"M1","T12","List",2)


Msg 128, Level 15, State 1, Line 17
The name "M1" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
Microsoft SQL Server 2008Microsoft SQL Server 2005

Avatar of undefined
Last Comment
samprg
Avatar of Kent Dyer
Kent Dyer
Flag of United States of America image

I don't think you can place your own values in the ID as it is usually an auto-created, auto-incremented ID and ususally created with an Index in a SQL table..

Try this instead:
insert into pt
        (vr,Title,TyppeID,pn)
 values ("M1","T12","List",2)

Open in new window


On second thought, you need to back up and review the datatypes for:
vr
Title
TyppeID
pn


HTH,

Kent
Avatar of samprg
samprg

ASKER

"ptid" is FK, not ID, I need to insert into table
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of samprg
samprg

ASKER

Thanks
Microsoft SQL Server 2005
Microsoft SQL Server 2005

Microsoft SQL Server 2005 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. It includes support for managing XML data and allows a database server to be exposed over web services using Tabular Data Stream (TDS) packets encapsulated within SOAP (protocol) requests.

72K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo