You are not logged in.
Pages: 1
hi all
i have a query
can any one tell me that when i create table in sql server 2005, it accept Colon ':' and dash '-' in tablename.
but when i try this create table with VBdotNet programm i got error
'syntex error near <table name>:'
Very Curious To See Your Replies
![]()
gr8.jain
Mumbai, India
Offline
i got this error at
myConnObj.Open()
myCommand = New SqlCommand("create table abc:xyz(myColumn1 varchar2(30) Not Null,myColumn2 numeric(10,2) Not Null",myConnObj)
myCommand.ExecuteNonQuery() -----error during debug
please help me how to use command for create table, insert into table and update table with table name contains special character like ":", "/", <blank space> " " or "-"
thanks in advance
????
Very Curious To See Your Replies
![]()
gr8.jain
Mumbai, India
Offline
![]()
Very Curious To See Your Replies
![]()
gr8.jain
Mumbai, India
Offline
You will have to do something like create table "abc:xyz"
but I would recommend against it, having strange characters in tablenames is making a lot of work for yourself
See here for more naming conventions:
http://vyaskn.tripod.com/coding_conventions.htm
Offline
Thanks Simon for your reply
but i have to do this actually i am importing data from database which already containing this type of table name which having (: / - and space ) in their table name
i need to import table with same name in sql server and then getting all the data containg that table in sql server (that is some kind of synchronizing of database - you may be say)
i am able to create table with out these special character but then i have to get error in fetching data becuase table name is differ
for that i use in VBdotnet - myVar = db.tablename.replace(":","")
so table like abc:Xyz is created as abcXyz
i think you got my point that now i am facing problem in import data
so better if i create table with same name
please try to give any solution
thanks
Very Curious To See Your Replies
![]()
gr8.jain
Mumbai, India
Offline
You need to use identifiers when using reserver words, words with spaces or funny characters in them:
http://doc.ddart.net/mssql/sql70/8_con_03_1.htm
CREATE TABLE [table:with,funny!characters] (...
Offline
Pages: 1