tags:

views:

40

answers:

2

Hi All,

I have a following table with primary key on TypeOfReport column and i am trying to insert records in it but i am getting an error :

The name "InvalidAwps" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.

Column1-TypeOfReport- (InvalidAwps, MissingNdcs);
Column2 - WebLinks(\\\InvalidAwps,\\\Missing )

Note : column1 and column2 will always have only two records. column1 will never change but column2 might have chances that it will change.

Here's the code:

/****** Object:  Table [PlanFinder].[ReportLinks] ******/
Create Table [PlanFinder].[ReportLinks]
(
[TypeOfReport]                        Char (11)             Not Null,
[Links]                               Money                 Null,
Constraint pk_TypeOfReport Primary Key Clustered (TypeOfReport))

Insert Into [PlanFinder].[ReportLinks]
(TypeOfReport, Links) Values (InvalidAwps, \\uafc.com\ReportLinks\InvalidAwps),

Thanks

+2  A: 

Try putting InvalidAwps in single quotes:

Insert Into [PlanFinder].[ReportLinks] (TypeOfReport, Links) 
Values ('InvalidAwps', '\uafc.com\ReportLinks\InvalidAwps')
JNK
+2  A: 

You need string delimiters

Insert Into [PlanFinder].[ReportLinks]
(TypeOfReport, Links) Values ('InvalidAwps', '\\uafc.com\ReportLinks\InvalidAwps')

However, then you'll get errors inserting the string \\uafc.com\ReportLinks\InvalidAwps into a money column...

or are \\\InvalidAwps,\\\Missing meant to be symbols of some kind?

gbn
@gbn - I was about to ask about that. Is this a link to a file or something?
JNK
@JNK: some info it could have been removed too, because it was not "code layout"!
gbn
thats actually the path of the report. thanks i forgot the inverted commas.
CombatCaptain