|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Insert stmt in MS SQL Server 2000
I´m running a MS SQL Server 2000 Dev Ed database, and I´m simply trying to do an insert. In a given table I have 2 columns, ID and Name. The ID column is PK and identity(1,1), and the Name column is simply text. I try to insert this:
insert into tableName (Name) values ("Any given name"); This does not work, it doesn´t seem to accept a string. I shouldn´t insert av specific value into ID, should I? Can anyone help me out of this deep dark place? //Frustrated newbie |
|
#2
|
|||
|
|||
|
I think Name is a reserved word. Try using a different column name? Or try
insert into tableName ([Name]) values ("Any given name") |
|
#3
|
|||
|
|||
|
Name is not a reserved word in SQL. Whenever you get some problem, include the error message in your post.
" is not a string delimeter in SQL use ' Code:
insert into tableName (Name) values ('Any given name')
|
|
#4
|
|||
|
|||
|
I think name is an ODBC Reserved Keyword.... I'd have to look it up, but in any case, these ODBC RK do not constrain SQL grammar......but to ensure compatibility with drivers that support the core SQL grammar, avoiding using words like this would be wise.....
but i use it all the time due to a lack of imagination of a better column name *shrug* |
|
#5
|
|||
|
|||
|
yea i just looked it up, it's names that is not name, oh well, guess i'm in the clear this time....
I wonder why it shows up blue in query analyzer then? is that because it's a method maybe? |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Insert stmt in MS SQL Server 2000 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|