|
I need to analyze one of the column values during an insert action, alter it and have it insert into the database and I figure an Instead of trigger is the best way to go. But, the table structure that my instead of trigger is on can change so I do not want to hard-code the column names in my trigger. How do I select from inserted and loop through the columns so that I can create another insert statement with those column names and values?
|
|
|
|
|
Okay, this is a question for a coworker.
Table A has two fields: partNumber, weight
Table B has two fields: partNumber weight
Table A has about 1000 records, table B has about 10,000 records.
Table A has the most recent information about weight. What he wants to do is if the part number in table A also exists in table B, update that weight with the weight from table A. (If the part number exists in table b, the weight is outdated.)
How can we do this in sql?
Thanks all!
|
|
|
|
|
|
Basically ignore any records in table B (with a weight) that doesn't have a corresponding record in table A.
Thanks Colin!
|
|
|
|
|
I told the guy this is for that you are from Scotland. He went on to tell me a story that at a previous job a Scotsman (sp?) and another guy apparently got upset over some dresscode changes, so they showed up at work wearing kilts for a week or so.
|
|
|
|
|
|
I pave ya driveway!
|
|
|
|
|
|
Just a weird expression of mine. Two common phrases here when you agree are:
1. I hear ya cluckin' big chicken!
2. I hear ya barkin' big dog!
I worked at Citibank with guy who claims he came up with those phrases and would have a fit when anyone else used them so I came up with new ones:
1. I pave ya driveway!
2. I squeeze ya Charmin!
3. I toast ya streudel!
Just consider it my crazy American personality.
|
|
|
|
|
|
Well, although I do claim to be the originators of them, please feel free to use them! (I'm sure you'll get some funny looks--good times.)
|
|
|
|
|
hi,
using disconnected architecture, i have generated a dataset consisting of three tables on a form which has a datagrid control and specified the data source as the dataset(and not as dataset.tablename).This shows me the table names on click of the "+" icon on the left top corner and on click of the table name, it navigates to the column names of the particular table clicked.How do i display the column types in the datagrid corresponding to the column names?
Could anyone suggest me any alternate way,if any?
thanks
i'll explain my issue more precisely....
basically, the objective is to create a dataset and fill it with three tables,print the entire table name in the dataset, print all the column names and it's type for each table.
And the following is what i have done:
i've dropped a datagrid on my form from toolbox and from server explorer, i have dropped three tables on the form and generated a single dataset(thus, using disconnected architecture).I've specified the datasource as datasetname in the properties of the datagrid.Now, on compiling and executing, i get a "+" icon on the left top corner of datagrid. On clicking this "+", i get display of the three table names and on clicking any table name,i get the all the column names of the corresponding table with no record sets in the datagrid. How could i get the column types for each and every column?
Is there any other method to perform this?
-- modified at 2:10 Friday 30th June, 2006
|
|
|
|
|
|
|
You have not actually asked any question. Do you want to tell us about your database, or do you want help with something?
|
|
|
|
|
This smells a lot like a homework problem, but it's the end of June so there shouldn't be much homework around right now.
You'll need to join the Mark table to the Lesson table to be able to look up the [Lesson Name] in the Lesson table, to include only those results where [Lesson Name] is equal to Lesson2. I'd then use the NOT IN operator to select those students from the Student table which don't appear in that set. In my view, NOT IN is clearer than trying to use some form of outer join and select rows which have a NULL indicating no match. On the other hand, NOT IN only works when you're trying to filter on a single column, if you have a compound key you're forced to use an outer join.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Mike Dimmick wrote: it's the end of June so there shouldn't be much homework around right now.
But there is always summer school.
|
|
|
|
|
Why don't you post a half-hearted attempt at an sql statement, and we will let you know how to fix it.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi
Im using VS 2005 and C# and the Enterprise Library 2.0. I want to design an application that can't be affected by the Database engine i used (SQL Server, Orcale, My Sql, Postegree) how can i acheive that since MySql and Postegree is not supported in Ado.net as
provider.
Thanks for your help
|
|
|
|
|
|
I already install the MySql Connector Net 1.0.7 but the problem is that i can't configure the MySql database through the Enterprise Library configuration, since My Sql is not listed as factory provider, i also can't use something like that:
Database db=DatabaseFactory.CreateDatabase();
the above line can work with Sql server and Orcale but how to work with MySql.
My purpose is to unify the code regardless of the database engine.
|
|
|
|
|
Ah, so you're using the Microsoft Data Access Application Block? You're quite right, it only supports SQL Server, Oracle and DB2 out of the box. You need to modify the code if you want to support MySQL and Postgres as well. The source code for Enterprise Library is supplied in the installation package, so you can inspect that.
There's a connector here[^] which may help, but note that it already says it's outdated and the original author hasn't fixed it. Still, it may give you a start.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi Friends,
Whats wrong here in the query?
insert into table1 (f1,f2,f3)
select f1 from table2 where table2.f2=4 and table2.f3=121034,1,41
I am inserting 3 values in 3 fiedls
f1=f1 of table2
f2=1
f3=41
It says
Server: Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near ','.
Naveed Kamboh
-- modified at 7:55 Thursday 29th June, 2006
|
|
|
|
|
probably you should use IN operator
SELECT f1 FROM table2 WHERE table2.f2=4 AND table2.f3 in (121034,1,41)
|
|
|
|