I have a select statement like this:
string Select = "Select TableofContents , DataOwner, Delegates From NYC";
and it work fine, but if I was to put a space in like this:
string Select = "Select Table of Contents, Data Owner, Delegates From NYC";
I would get an error in my da.fill(ds);
Why can I not use a space in my select statement. I have to connect to a db,
but I can not change it. 5 2826
string Select = "Select [Table of Contents], Data Owner, Delegates From
NYC";
"freddy" <fr****@discuss ions.microsoft. com> wrote in message
news:08******** *************** ***********@mic rosoft.com... I have a select statement like this: string Select = "Select TableofContents , DataOwner, Delegates From NYC";
and it work fine, but if I was to put a space in like this: string Select = "Select Table of Contents, Data Owner, Delegates From NYC";
I would get an error in my da.fill(ds);
Why can I not use a space in my select statement. I have to connect to a db, but I can not change it.
do not work
"Jared" wrote: string Select = "Select [Table of Contents], Data Owner, Delegates From NYC";
"freddy" <fr****@discuss ions.microsoft. com> wrote in message news:08******** *************** ***********@mic rosoft.com...I have a select statement like this: string Select = "Select TableofContents , DataOwner, Delegates From NYC";
and it work fine, but if I was to put a space in like this: string Select = "Select Table of Contents, Data Owner, Delegates From NYC";
I would get an error in my da.fill(ds);
Why can I not use a space in my select statement. I have to connect to a db, but I can not change it.
"freddy" <fr****@discuss ions.microsoft. com> wrote in message
news:08******** *************** ***********@mic rosoft.com... I have a select statement like this: string Select = "Select TableofContents , DataOwner, Delegates From NYC";
and it work fine, but if I was to put a space in like this: string Select = "Select Table of Contents, Data Owner, Delegates From
NYC"; I would get an error in my da.fill(ds);
Why can I not use a space in my select statement. I have to connect to a
db, but I can not change it.
The short answer is that the names in your query must match the table and
field names defined in the database.
You cannot decide to introduce spaces in the names when you write the query.
What database are you using?
I believe the question is whether or not the database you are querying
allows spaces in table and field names.
The solution of enclosing the name in [] if there are spaces works OK in an
Access database, but many databases will not permit spaces in names.
Jared's response indicating use of [] should work in an Access database if
you have filed defined in the NYC table with names "Table of Contents" "Data
Owner" and "Delegates" .
Freddy's response to Jared that his solution did not work is probably based
on the fact that Jared placed [] around only one of the two field names that
contain embedded spaces.
OTOH, Oracle would not have permitted field names with embedded spaces in
the first place.
IMHO, using table and field names with embedded spaces (even if permitted by
the DBMS) is a poor practice that will end up causing far more trouble than
it saves.
--
Peter [MVP Visual Developer]
Jack of all trades, master of none. OTOH, Oracle would not have permitted field names with embedded spaces in the first place.
YES it does - you must wrap the column or table name with double quotes.
Consider something like this:
CREATE TABLE "my stuff"{
"first name" VarChar2(30),
"last name" VarChar2(30))
TABLESPACE USERS
STORAGE(INITIAL 1M NEXT 1M PCTINCREASE 0)
/
SELECT "first name" FROM "my stuff"
and
SELECT *
FROM USER_TAB_COLS
WHERE TABLE_NAME='my stuff'
IMHO, using table and field names with embedded spaces (even if permitted
by the DBMS) is a poor practice that will end up causing far more trouble
than it saves.
I agree 100 percent!!! -- Peter [MVP Visual Developer] Jack of all trades, master of none.
In SQL Server, you need to you [] just as Jared said. Maybe you use a
different DB - what is ur DB?
"freddy" wrote: do not work
"Jared" wrote:
string Select = "Select [Table of Contents], Data Owner, Delegates From NYC";
"freddy" <fr****@discuss ions.microsoft. com> wrote in message news:08******** *************** ***********@mic rosoft.com...I have a select statement like this: string Select = "Select TableofContents , DataOwner, Delegates From NYC";
and it work fine, but if I was to put a space in like this: string Select = "Select Table of Contents, Data Owner, Delegates From NYC";
I would get an error in my da.fill(ds);
Why can I not use a space in my select statement. I have to connect to a db, but I can not change it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hans Maurer |
last post by:
>Description:
We're running our current TTS application with MySQL (on Unix). All database,
table and column names are in lower-case. However, we need to access this
database with a new application which (for some reason) converts all
table and column names in its SELECT statements to uppercase.
Since MySQL is case-sensitive on Unix, I added the statement
set-variable = lower_case_table_names=1
to /etc/my.cnf. However, statements...
|
by: alexqa2003 |
last post by:
got a table with (class, name, exam, score) fields.
To find max(score) for exam that starts with letter 'm'
grouped by class and name,did:
select max(score) from #temp where exam like 'm%'
group by class,name
this work only for selecting max(score) from #temp.
How to select all columns and max(score) at the same time,
|
by: Leader |
last post by:
Hi All,
I am getting slower performance of select statements in MS SQL. I am
finding select statements in MS SQL are even slower than MS ACCESS. Is
there any way to improve the performance of select statements in MS
SQL by tuning the database of anything else??
Thanks in advance!
Hoque
|
by: Edwinah63 |
last post by:
Hi Everyone,
All the very best for 2004!!
i need urgent help with this problem, the users are about to skin me
alive!!
we have an access front end with linked to sql server 2k tables.
when a user tries to insert a record into one of the tables it
|
by: grunar |
last post by:
After some thought on what I need in a Python ORM (multiple primary
keys, complex joins, case statements etc.), and after having built
these libraries for other un-named languages, I decided to start at the
bottom. What seems to plague many ORM systems is the syntactic
confusion and string-manipulation required to build the SQL Statements.
If you want to do a Left Outer Join, support nested functions, and a
nested conditional clause, you'd...
| |
by: Tcs |
last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't
loaded it yet. I'm still using MS Access. And no, I don't believe this is an
Access question. (But who knows? I COULD be wrong... :) I've tried the
access group...twice...and all I get is "Access doesn't like ".", which I know,
or that my query names are too long, as there's a limit to the length of the SQL
statement(s). But this works when I don't try to...
|
by: Ed L. |
last post by:
I think I'm seeing table-level lock contention in the following function
when I have many different concurrent callers, each with mutually distinct
values for $1. Is there a way to reimplement this function using
select-for-update (or equivalent) in order to get a row-level lock (and
thus less contention) while maintaining the function interface? The docs
seem to suggest so, but it's not clear how to return the SETOF queued_item
and also...
|
by: =?Utf-8?B?VGVycnk=?= |
last post by:
I have coded multiple select statements in a single stored procedure, and
when I execute this procedure on SQL Server Management Express, I correctly
get multiple result sets. But, if I try to add a new Data Source to to my VB
2005 project, and point to this stored procedure, the data source wizard only
sees the 'first' select statement. Is there a way to load multiple tables in
a DataSet from a single stored procedure with multiple...
|
by: sijugeo |
last post by:
Hi,
I am using SQL SERVER 2005.
I have two select statements. The code is given below.
-----------1.--------------------------
select d.idx_Delivery,s.idx_Stops,case FixedFlag when 1 then Price when 0 then Price*(Percentage/100)
else 0 end DeliveryCharge from Tbl_Deliverables d
inner join Tbl_Stops s on s.idx_Delivery=d.idx_Delivery
|
by: bharathi228 |
last post by:
How to write two or more select statements in a single query
here my requirement is
SELECT dbo.SYS_PARAMS.PARAMETER_NAME, dbo.SYS_PARAMS.PARAMETER_UNITS, SYSTEM2.dbo.CALIBRATION.CAL_TYPE,
SYSTEM2.dbo.CALIBRATION.CAL_TIMESTAMP, SYSTEM2.dbo.CALIBRATION.MEASURED_VAL, SYSTEM2.dbo.CALIBRATION.EXPECTED_VAL
FROM SYSTEM2.dbo.CALIBRATION INNER JOIN
dbo.SYS_PARAMS ON SYSTEM2.dbo.CALIBRATION.PARAMETER_INDEX = dbo.SYS_PARAMS.PARAMETER_INDEX INNER...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |