|
If exists( (select query with where clause for 1st table) or (select query with where clause for 2nd table))
----implies that there is a record according to the condition in either of the tables.
gauthee
|
|
|
|
|
Hello all,
I have an old C++ program that uses sql2000. Now I need to migrate the database to sql 2005 express. I don't have access to the program fonts.
The thing is that this program creates some tables with names such as "S7:[PLC1|VFD1|S7online]DB118,B28,1" (yes, all of that...). Now, after the installing sql2005, the C++ program can not create the tables any more, displaying the message:
CADORecordset Error
Code=80040e14
Code meaning=IDispatch error#3092
Description=An object name or column is missing or empty. Verify is all the columns of the SELECT INTO instructions have names. At the other instructions, search for empty alias names. Alias defined as " " or [] are not alowed. Add a name or unique space as a alias name.
I've tried to set the compatibility mode to sql80 using the
"EXEC sp_dbcmptlevel dbname, 80" instruction. After that, the error message has stopped, but still no tables are created.
I actually can create a table with the name "S7:[PLC1|VFD1|S7online]DB118,B28,1", executing a "create table" at the management studio. But I can only creat it if the table name is between doble quotation marks ("). I suspect that the C++ program puts the table name between single quotation marks ('), or no quotation marks at all. If I try in this way at the management studio I get an error.
Anybody have any ideas of how I can make this work whitout changing the C++ program??
Thanks
Peterson
|
|
|
|
|
If it's stored as a plain string in the original app you might be able to use a hexeditor.
Another option is asking over on http://forums.microsoft.com[^]. They're normal pretty good over there.
|
|
|
|
|
Ok, now I´ve manage to solve the inicial problem. The problem was with the sql2005 instace name, and I figured out how to change the connection string.
The c++ program created the tables, but now when it tries to store any data, I get an "SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value" error message.
When I change the connection string to connect in the sql2000, everything works fine. I tryed changing the windows regional settings, but nothing happened...
Any ideas?
Thanks
Peterson
|
|
|
|
|
I improved on an application that was found on this site (OQuery). I made it so that it could access different types of DBMS such as MySQL, Oracle (which is originally did), MS-SQL 2000. I had two people ask me if I used ODBC which I replied that I used ADO.
I'm a little confused because now I'm having trouble with the differences between ADO and ODBC. I thought ADO ends up using ODBC....right?
I've also heard that an ODBC connection is 10 slower than that of ADO....can someone confirm this. And should I be using ODBC?
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Yes, ADO is a wrapper to ODBC. But I think you really mean ADO.Net?
|
|
|
|
|
Yes...ADO.NET. So why am I being asked if I used ODBC. Is there some ODBC secret that's not being shared that I should know about?
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
lol, not at all. ODBC is very old and low level. ADO.net, however, is a new(er) implementation for data access and pretty fast. For one, it allows for disconnected datasources which, in itself, is much more efficient for the server (server doesn't have to manage connections). Perfect for web apps. ODBC was used more for the old client/server connected model.
It almost sounds like you're being asked about ODBC because the datasource they want to use doesn't have an ADO.NET connector available?
|
|
|
|
|
That's possible...although all of the options that I've added to my app have a .NET connector.
I'm also wondering is they are asking that because have a different provider for each type of database is not really important.
Between you an Mike, you'ver really cleared this up....now I look and sound smarter.
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
ADO is a wrapper for a technology called OLE DB, although it has little to do with OLE (Object Linking and Embedding). The database-specific layer (called a Provider) is a set of COM objects which implement interfaces designed by Microsoft. The client talks directly to the OLE DB provider with no intermediary. ADO is a classic VB-friendly wrapper for OLE DB.
ODBC (Open Database Connectivity) is based around a manager/driver model. Applications talk to the ODBC manager, which talks to the drivers. The extra overhead is generally minimal. ODBC is the ANSI standard interface defined in the SQL standard.
To enable transition to ADO/OLE DB from ODBC, i.e. so that client application developers could use the new interface before the database developers released OLE DB providers, Microsoft made a special provider called the OLE DB Provider For ODBC available (its ProgID, which you specify in the Provider connection string parameter, is MSDASQL). You should only use this where there is no native OLE DB provider. This provider adds extra overhead and implements a reduced feature set compared to native OLE DB providers. Unfortunately it's also the default provider - it's what you get if you don't specify a Provider in the connection string.
The relative speed of ODBC and ADO is all down to the provider and driver, but in general, all else being equal, ADO should be slightly faster than ODBC if you're using a native OLE DB provider.
ADO.NET is slightly misnamed in the .NET Framework. It's really a general umbrella name for 'how .NET does data access'. The desktop Framework ships with four Providers (the name is the same but the concepts have changed) - two generic (OLE DB, ODBC) and two specific (SQL Server, Oracle [since 1.1]). You can also obtain third-party Providers. The cost of calling a COM object is slightly higher than calling a 'flat' API like ODBC in the .NET Framework, so OLE DB's small performance advantage is mostly negated.
You can access a third-party database like MySQL either through a native .NET provider or via an OLE DB provider (using OleDbConnection) or ODBC driver (using OdbcConnection). Generally you should prefer a native .NET provider as it's likely to have more features and less translation.
|
|
|
|
|
Wow.....thanks for the great explination. Okay so if the database creator....for better use of the word....provides a .NET provider then it's best to use it. And if I wanted to add an "Other Database" option to my program...I can always use ODBC to connect to the "Other" database and run a query.
I guess the great thing about ODBC is that I would not have to install all the providers for each of the different types of DB's out there. So now I understand why I keep getting asked if I'm using ODBC.
DING....the light came on
Tom Wright
tawright915@gmail.com
|
|
|
|
|
It's worth knowing that the native providers, e.g. the SQL Server providers, generally use the databases native API, so you get the best speed because they aren't dealing with the plumbing that technologies that ODBC put in place.
|
|
|
|
|
Hi,
In SQL Server, for seeing the table structure, we use the query sp_help <tablename>. Is there anything similar in Sybase like this? Pls help.
Thanks
Meeram395
|
|
|
|
|
The Sybase equivalent is "sp_help <tablename>". At one time, MS SQL-Server and Sybase SQL-Server (or whatever they call it these days) used to have the same code-base and system catalog tables.
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".
|
|
|
|
|
To get the list of columns and their types with any SQL database I get an IDataReader for
SELECT * FROM table , then I simply call its GetSchemaTable() method (I don't read the data).
|
|
|
|
|
in the mysql command-line I did:
mysql> create database myDB;
mysql> use myDB;
mysql> source mySource.sql;
and I get lines as -
Query OK, x rows affected, y warnings (z sec)
My question: How\where can I see what were the warnings, so I can fix them?
Thanks,
Atara
|
|
|
|
|
found it:
mysql> SHOW WARNINGS;
Atara
|
|
|
|
|
Hi all,
In VS2005, I use OracleConnection class of Oracle.DataAccess.Client Namespace so connect to Oracle database throw exception: "ORA-12705: Cannot access NLS data files or invalid environment specified".But i use OracleConnection class of System.Data.OracleClient is fine.
Please help me.Thankx
|
|
|
|
|
I have these three Tables,
customers, cust_order, cust_debit
customers primary ID is added to cust_order and cust_order primary key is added to cust_debit.
I want records from customers and cust_order table on a condition which is associated to cust_debit. Tables Structure is as follow
cutomers cust_order cust_debit
cust_id fname, lname, ...... order_id, cust_id, order_date ID, order_id, amount
I need fname, lname, order_id, order_date from customers and cust_order where cust_debit.amount >=2000,
Now I need only one record of a particular customers.I used the following query
SELECT cust_order.order_id as order_id, customers.fname as fname , customers.lname as lname, cust_order.order_date as order_date,cust_order.order_status as order_status from cust_order,customers, cust_debit where customers.customer_id=cust_order.customer_id and cust_order.order_id = cust_debit.order_id and cust_debit.amount >=200
It works fine, But I need only one record of a customers, like when we use DISTINCT.
How can I use that.
Pls Help me
Thanks in Advance.
|
|
|
|
|
|
I have vote u 5.
Ya the link u have given I have already seen that, but I cant understand that. Pls
Help me and read my post carefully and then set query and then post if u dont mind it.
Thanks in Advance.
|
|
|
|
|
I'm not really sure what you are trying to acheive with the "cust_debit" table. It looks like it contains the amount outstanding for each order.
If it is the amount outstanding then the following change would give you the latest order for any customer who has a total of more than 2000 outstanding:
....
from (
select customer_id, max(order_id)
from cust_order
inner join cust_debit
on cust_debit.order_id = cust_order.order_id
group by customerId
having sum(cust_debit.amount) >= 2000
) as lastest_order_id
.... The following uses a correlated-subquery to give you customers where any one single order has more than 2000 outstanding:
....
from (
select customer_id, max(order_id)
from cust_order
where 2000 <= (
select sum(cust_debit.amount) from cust_debit
where cust_debit.order_id = cust_order_id)
group by customerId
) as lastest_order_id
.... Both examples give the details of the most-recent order. If you want the oldest order then use min(order_id) . Hopefully you should now be able to solve your problem using one of these examples.
Regards
Andy
|
|
|
|
|
Dear there is a problem in ur query its not working correctly, infact system hangs when I execute ur query.
Pls help me. I m tied of this query.
|
|
|
|
|
Not half as tired as I am! I don't mind helping people, but it doesn't seem like you are trying very hard.
How about you putting some effort into understanding what the queries are trying to do. The SQL that I provided is basically three separate select-statements layered inside each other. I would suggest that you get the inner-most query working first:
select customer_id, max(order_id)
from cust_order
inner join cust_debit
on cust_debit.order_id = cust_order.order_id
group by customerId
having sum(cust_debit.amount) >= 2000 and the build up gradually to your final solution. If your machine is hanging then that may indicate that your database is not indexed properly.
|
|
|
|
|
Hi,
What sort of rigts needed to create tablespace in oracle?
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language, so please don't mind if i do some grammatical or spelling mistakes in my messages."
|
|
|
|