|
Not sure what your datasource is but chances are you can only insert into one table at a time. To ensure all rows are inserted into all tables use a transaction.
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
Thanks & Appreciate you Micheal
Now the query is working.
|
|
|
|
|
Hi,anyone know if there exists a sql-server database gui for linux?
I have searched but nothing free found.
|
|
|
|
|
Let's assume I have three tables, where Table1 is the topmost table, Table2 is a child relation to Table1 and Table3 is a child relation to Table2. I'd like to get all rows in Table1 where a column in Table3 is a particular value. This is fairly straight forward with an SQL query, but I can't figure out how to do it with DataTables/DataSets. Any suggestions?
The only solution I've been able to come up with involves getting every row in Table1, and then GetChildRows twice to get to Table3, and testing the column of interest in Table3...
foreach (DataRow row in Table1.Rows)
{
if (row.GetChildRows("Table1-Table2")[0].GetChildRows("Table2-Table3")[0]["ColumnOfInterest"] == something)
{
This is one of the desired rows, do something with it
}
}
Seems very cumbersomb. You'd think there'd be a way to execute a single "query" that would return the desired set of rows...
|
|
|
|
|
How about reversing the process, and preselecting just the columns of interest
DataRow[] interestingRows = Table3.Select("columnOfInterest = something");
foreach(DataRow r1 in interestingRows)
{
DataRow r2 = r1.GetParentRow("Tabel2-Table3").GetParentRow("Table1-Table2");
// do something with this if not null
}
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Thanks... That would definitely do the trick, and I'll play around with it, but to my question, is there some way to perform this operation with a single Select "like" call? Maybe there isn't a way to do this, and that's fine, I'll continue working with nested foreach constructs, but I keep thinking the disconnected DataSet should be able to perform operations that are possible with SQL. As I'm sure you're aware, the SQL equilalent of what I'm trying to do with the DataSet is as follows...
SELECT * FROM TABLE1,TABLE2,TABLE3 WHERE TABLE1.Table2Link=TABLE2.Table1Link AND TABLE2.Table3Link=TABLE3.Table2Link AND TABLE3.ColumnOfInterest=something
|
|
|
|
|
Hello all,
I made a database in my server but when i generat a script for this database and run it in another server the Digram dosnt apper in the second server.How can if i change relation in the first digarm make this changes in the second database
note: the database filled with some data
hay
|
|
|
|
|
webhay wrote:
I made a database in my server but when i generat a script for this database and run it in another server the Digram dosnt apper in the second server
The diagrams are not scripted as they will change dynamically with the data model in the database. The diagrams are just a graphical representation of the tables in the database and their relationships.
webhay wrote:
How can if i change relation in the first digarm make this changes in the second database
Script the change. Don't use Enterprise manager - learn how to make these changes in script so you can test the changes on a development server, make sure that they work without breaking the database, then apply the script (after fixing any bugs) to the live system.
Generally it is a good idea to take a backup of the live system and restore the backup on a development box to test your change-script on so that the development environment is as close to the live system as possible.
Does this help?
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums Upcoming talk:
SELECT UserName, Password FROM Users
-- Getting unauthorised access to a SQL Server, and how to prevent it.
|
|
|
|
|
I am working on Windows 2000 professional. I have installed MSDE 2000 and also SQL server 2000 (Client components only).
But when i go through the Enterprise Manager of SQL Server, it is not identifying any server. It is displaying something like:
Server is not found or Access denied. Connection Open
when i tried to run in command prompt also (C:/>osql ....) it is saying connection open error.
can anyone please help?
thank you
|
|
|
|
|
|
I have checked from Administrative Tools -> Services, that sQL server service is running.
still i have this problem.
Can you tell me whether i need to install service pack SP3a in addition with MSDE 2000?
|
|
|
|
|
BSRK wrote:
Can you tell me whether i need to install service pack SP3a in addition with MSDE 2000?
Installing Service Pack 3a is generally a good idea anyway because, IIRC, it contains the security fix for the Slammer worm.
BSRK wrote:
I have checked from Administrative Tools -> Services, that sQL server service is running.
So, are you attempting to log in using the correct credentials? Have you typed the user name and password correctly? Did you set it to use Windows Authentication? and if yes, are you trying to connect using the same account that it was installed with (or with an account that has been granted access)?
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums Upcoming talk:
SELECT UserName, Password FROM Users
-- Getting unauthorised access to a SQL Server, and how to prevent it.
|
|
|
|
|
|
|
MSDE and Enterprise manager work fine together. There is a grey area when it comes to the licencing of the software. But there is no technical reason why Enterprise Manager can't see your MSDE database.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
A new installation of MSDE is configured in Windows Authentication mode. You must use a trusted connection (e.g. osql -E) to connect to it. If you want to be able to supply a username and password you will need to reconfigure for mixed mode.
If you downloaded MSDE recently, you will have MSDE Release A. If you accept the default install parameters, this version of MSDE disables all networking protocols. You can only access it from the machine it's installed on, using the Shared Memory protocol. Follow the instructions in KB 814130[^] to re-enable network access.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Please tell me how to connect to a MySql Database and also explain the classpath requisites.
|
|
|
|
|
|
Hello all,
I have 4 tables the first table contain IDs from the other 3 tables. I need to Select the names from the other tables by the IDs in the first table
1- tbl
1|2|4
2- tbl
1|manager
3-tbl
2|Desgined
4-tble
4|Computer
please help
Thanks
hay
|
|
|
|
|
|
Thanks Colin ,
It is working but it give me duplicate recorder is there is a way to avoid duplicate.
Thanks for your time.
hay
|
|
|
|
|
|
I need to update a field so the values change from all upper case to title case. Can anyone please point me to a sql script example of how to do this. Thanks,
Jason W.
|
|
|
|
|
Hi,
U can use...............
UPDATE Customer
SET
C_Name = LOWER(C_Name)
I hope this will help u..........:->
Regards,
Ritesh
|
|
|
|
|
Thanks for the try, but that won't work. Lower gives the following results:
Select lower('TEST')<br />
---- <br />
test
The following would work if there was only one word:
Select upper(left('TEST',1)) + lower(substring('TEST', 2, len('TEST')))<br />
----- <br />
Test
Problem is when you have more then one word such as:
DECLARE @TEST as varchar(50)<br />
SET @TEST = 'TEST TEST TEST'<br />
Select upper(left(@TEST,1)) + lower(substring(@TEST, 2, len(@TEST)))<br />
--------------------------------------------------- <br />
Test test test
The results I want are
---------------------------------------------------
Test Test Test
Any idea on how to output this format?
Thanks again.
Jason W.
|
|
|
|