473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I programatically acces a database with a '-' in the name?

use this-is-a-stupid-name

returns an error

For that matter

select *
from this-is-a-stupid-name.dbo.anytable

returns an error

I've tried single quoted, double quotes, escaping. In the SQL editor I can
select the name from the dropdown and I'm OK - but I'm writing a perl
script to connect to the database.

I didn't create the database and don't know how it was created.

--
Message posted via http://www.sqlmonster.com
Jul 23 '05 #1
2 1006

"Evelyn Schwartz via SQLMonster.com" <fo***@SQLMonster.com> wrote in message
news:1f******************************@SQLMonster.c om...
use this-is-a-stupid-name

returns an error

For that matter

select *
from this-is-a-stupid-name.dbo.anytable

returns an error

I've tried single quoted, double quotes, escaping. In the SQL editor I
can
select the name from the dropdown and I'm OK - but I'm writing a perl
script to connect to the database.

I didn't create the database and don't know how it was created.

--
Message posted via http://www.sqlmonster.com


See "Delimited Identifiers" in Books Online:

select * from [this-is-a-stupid-name].dbo.anytable

You can use the QUOTENAME() function to add the identifiers.

Simon

Jul 23 '05 #2
Thanks works like a charm. Half the battle is knowing where to look!

--
Message posted via http://www.sqlmonster.com
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kona | last post by:
Hello, I would like to known if it is possible to limit acces to a UDB database on Solaris system through db2connect to only specified clients ? My client is a db2connect on Windows platform. ...
1
by: TTD_hck | last post by:
Hello, I need suggestions for the following. I have a acces 97 database and with a script command in acces 97, I can e-mail a file via outllok. I do this with the folowing command in Acces 97:...
3
by: Tym | last post by:
OK - daft question of the day time... If I have database A which contains all the live data, and Database B which contains linked tables to those is A (i.e. a front end) is there a way of seeing...
0
by: John Smith | last post by:
I am currently using excel to manage a small database. The problem is my database is getting big and I need more then the 65000 lines excel can have. I have considered access but it lacks some...
1
by: Richard Hollenbeck | last post by:
I have a report that is dynamically naming the columns and rows, etc., but I have way more columns (at least 37 at this time) than will fit on the report comfortably. So I have ten columns on the...
1
by: Alberto A. Villa | last post by:
Someone knows how to drop this big difficulty?? A Data Base in MS-Access 2002, condivided with multiple client, had link failure with a client. From this time until now, none can open the file...
3
by: PC Datasheet | last post by:
Using code in MyDateBase I create a new database named MyNewDatabase. Now I need to import (or export) using code in MyDatabase tables in another external database named MyData to MyNewDatabase....
10
by: PC Datasheet | last post by:
How can I programatically set the startup form when the database opens? Thanks! Steve
0
by: ev00l | last post by:
Hey, this is my first time posting something on usenet, so plz be kind and mannered. Q1: I made a project where i get some information from a database, and populate them into a datagridview....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.