Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database name with '-' in it

Status
Not open for further replies.

Luvsql

Technical User
Apr 3, 2003
1,179
CA
I have successfully created a report referencing a database called database-name.dbo.tablename. However, after I saved it and tried to refresh it, I get a syntax error near '-'. I copied the sql query that crystal generated and ran it in sql query analyzer and got the same error. When I changed it to [database-name].dbo.tablname, it ran fine in query analyzer. But adding the [] in crystal then gave the error that there are no fields in the table ie it did not recognize it as being the table with the [] around it.

How was I able to query the table in crystal before it was saved ie I was printing data from the report fine until after I closed crystal and re-opened. How can I reference a database in crystal that has the - in the name?
 
You don't mention the driver you are using, nor your version of Crystal. Those items would be helpful. However, the "-" in the table name is a problem. The following kb article will step you through setting up an alias for the table name, which should resolve your problem.

 
I am using Crystal 8.5 Pro accessing SQL Server 2000 database using the pdsodbc.dll (version ? cuz I cannot seem to locate that local dll ). The table name does not have the '-' in it (in that case I could use a table alias within Crystal), but the database name itself has the '-' in it.
 
Sorry for misreading that. I tried to recreate your problem and couldn't. I was able to create, save, close and then re-open a report written against a SQL Server db with the "-" in the database name. But there is a kb that deals with a similar issue. The suggested workaround would require the following in Crystal:

Go into Database | Set Location and remove the database and owner from the table name.

I'm not sure that will work, but it's worth a try.
 
When I remove the datbase.dbo. from set location, I can print it in Crystal reports because it prompts for the login as well as the database, but when I try to print this using Crystal Enterprise via web URL, I get an error because the database name is no longer there. I had to manually select the default DB in the ODBC and it now works! ! Thanks very much for your help. I can never seem to find what I'm looking for in knowledge bases!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top