|
i have two tables a and b.a has 7 different columns and b has 20 different columns. i want to insert rows from a to b.how to insert.
so plz provide solution
|
|
|
|
|
Read records from table a and insert them into table b, adding the detail for the extra columns.
Veni, vidi, abiit domum
|
|
|
|
|
Here is a sample. have done this using SQL Server but it shouldn't be hard to move it too one of the other databases
create table #tableOne
(
id int,
name varchar(50),
email varchar(100)
)
create table #tableNames
(
id int,
name varchar(50)
)
insert into #tableOne values (1, 'simon','simon@email.com')
insert into #tableOne values (2, 'someone','someone@email.com')
insert into #tableNames values (3, 'fred')
insert into #tableOne
select id, name,''
from #tablenames
select *
from #tableOne
drop table #tableNames
drop table #tableOne
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Are they any non null-able columns in table b ?
IF they are non null-able columns then follow below code
INSERT INTO b(<<Column_Names>>)
SELECT <<Column_Names>> from a [where <<Condition(if any)>>]
Mani Prabhakar
|
|
|
|
|
INSERT INTO b
(field list b)
SELECT
field list a
FROM
a
|
|
|
|
|
Specify Columns Of Table B.
Like
Insert Into B (Col1,Col2,Col3)
Select Col9,Col8,Col7 From A.
Please Note That Data Type of Column Should Be Same.
|
|
|
|
|
how to use fuzzy object oriented database sql?
have to install any other software behind SQL Management Server 2008 ?
this is the query :
Select t.*, t.muAge('mid')asMu_Age, t.muHeight('tall')asMu_Height, t.muWeight('heavy')asMu_Weight, CalcTreshold(&wAge,&tAge,&wHeight, &tHeight,&wWeight,&tWeight) asTre From TBLPersons t Where ((((t.muAge('mid')*&wAge)+ (t.muHeight('tall')*&wHeight)+ (t.muWeight('heavy')*&wWeight) ) / (&wAge+&wHeight+&wWeight) )
>= calctre (&wAge,&tAge,&wHeight, &tHeight,&wWeight,&tWeight ) )
modified 8-Oct-13 3:52am.
|
|
|
|
|
jojoba20 wrote: how to use fuzzy object oriented database sql? Ask the vendor; the people that supply the "fuzzy object oriented database" software should know how to install it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i dont known any one.
I wanna to get help from Code Project world!
I dont known that does need to install any application or ...
Thanks in advanced!
|
|
|
|
|
jojoba20 wrote: i dont known any one. Then how did you deduce that it must be a fuzzy object-oriented query? Where did you find this code?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
for my collage !
my sir asked me to do that !
and also he doesnt help any!
|
|
|
|
|
jojoba20 wrote: for my collage ! my sir asked me to do that ! and also he doesnt help any! Ah..
Object-orientend means that you model the world according to objects (containing other objects) and their relations; relational means that you model the world into lists, with a relational to other lists. Fuzzy is something that is used more in logic than in storing data.
Data shouldn't be "fuzzy". Your client is either male or female, the data we store are facts. Imagine one of those facts becoming fuzzy.
My apologies for being rude; you seemed stubborn, but then again, you'll need something that convinces your collage. Feel free to ask more details if he keeps refusing the answer.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
this is example but i dont know where to exicute the code (is it possible to have in sql server 2008?
http://archivaleffort.academickids.com/encyclopedia/index.php/Object-relational_database[^]
Comparison to RDBMS
In an RDBMS, it would be fairly common to see SQL statements like this:
CREATE TABLE Customers (
Id CHAR(12) NOT NULL PRIMARY KEY,
Surname VARCHAR(32) NOT NULL,
FirstName VARCHAR(32) NOT NULL,
DOB DATE NOT NULL
);
SELECT InitCap(Surname) || ', ' || InitCap(FirstName)
FROM Customers
WHERE Month(DOB) = Month(getdate())
AND Day(DOB) = Day(getdate())
which some OO fans would describe as overly complex logic. Furthermore, most current SQL databases allow the creation of custom functions, which would allow the query to be expressed as:
SELECT Formal(Id)
FROM Customers
WHERE Birthday(Id) = Today()
In an object-relational database, one might see something like this, where the data types and expressions such as BirthDay() are user-defined.
CREATE TABLE Customers (
Id Cust_Id NOT NULL PRIMARY KEY,
Name PersonName NOT NULL,
DOB DATE NOT NULL
);
SELECT Formal( C.Name )
FROM Customers C
WHERE BirthDay ( C.DOB ) = TODAY;
|
|
|
|
|
That query won't work in Sql, nor any database-implementation that I know of. It's either a relational, or an object-oriented database.
"Object relational" sounds like theory to me.
jojoba20 wrote: which some OO fans would describe as overly complex logic. Some OO fans should do their homework. Relational is a way of modelling, like object-oriented. One can't become "more like" the other, since it's two different ways of looking at stuff.
jojoba20 wrote: In an object-relational database, one might see something like this, where the data types and expressions such as BirthDay() are user-defined. Right.
Creating functions doesn't make it "object-relational".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
thanks for your help!
in which management i can have object-oriented database ?
i wanna to design object oriented database BUT i dont know in which platform or management i can do that ??????
thanks in advanced!
|
|
|
|
|
|
thanks but is there any software that i can make(create) FOODB (Fuzzy Object Oriented DataBase) for SQL ?
I am seeking for software to create the DB first.
I am confuzed!
Thanks in advanced!
|
|
|
|
|
I have no idea, but I gave you a Google search with lots of links, it's up to you to go through them and see if any contain what you are looking for.
Veni, vidi, abiit domum
|
|
|
|
|
thanks
I have searched that before but doesnt get any thing!
|
|
|
|
|
So maybe there isn't any.
Veni, vidi, abiit domum
|
|
|
|
|
jojoba20 wrote: is there any software that i can make(create) FOODB (Fuzzy Object Oriented DataBase) for SQL ? There is no such thing as a "fuzzy" object oriented database. The example you lnked to does not apply to an existing product.
jojoba20 wrote: I am seeking for software to create the DB first. Simply use SQL Server and you can create databases. Why does it need be "fuzzy"?
jojoba20 wrote: I am confuzed! ..because you're looking for something that does not exist.
"Fuzzy object-relational"? What kind of data are you going to store that you're interested in that collection of buzzwords?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
so how to use the code bellow ?
I wanna have Object Oriented DataBase (In an object-relational database, one might see something like this, where the data types and expressions such as BirthDay() are user-defined.)
this is example code for creating Table but give error in SQL Server Management 2008 !
CREATE TABLE Customers (
Id Cust_Id NOT NULL PRIMARY KEY,
Name PersonName NOT NULL,
DOB DATE NOT NULL
);
SELECT Formal( C.Name )
FROM Customers C
WHERE BirthDay ( C.DOB ) = TODAY;
|
|
|
|
|
jojoba20 wrote: so how to use the code bellow ? The code from the example is not real code.
jojoba20 wrote: I wanna have Object Oriented DataBase Then download one.
jojoba20 wrote: In an object-relational database Object-relational is nonsense.
jojoba20 wrote: this is example code for creating Table but give error in SQL Server Management 2008 ! That's not example code, it's a made-up example. Sql Server is not an object oriented database and is not a fuzzy database. One talks to it using Sql, or using an ORM.
The example sql statement is a pack o' nonsense. I mean, convert C.DOB to a birthday? If you need a function, create one in SQL. There are dozens of manuals on how one creates a function and how to use that function in a query. Real examples, not converting X to X. Even the "formal" function is something that's standard SQL.
1) it's not a real life example
2) it's not real code
3) you don't need it
I'm convinced of 3 since you haven't named a single argument that says "need". I only read "want" from someone who cannot explain what it is he needs.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Have a read of this wiki page: Object Orientated database systems.[^]
as you can see the example you have been given come from here! the examples from this wiki page show that the SQL was and is written around database servers such as postgres etc.
The code like Eddy has said wont work on SQL Server!
The create table [^] statement is incorrect as you haven't specified the correct datatypes.
The Select statement wont work either, why? because you would need to create User definded functions[^] for Formal and BirthDay
for further reading Relational database systems (RDBMS)[^]
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
jojoba20 wrote: how to use fuzzy object oriented database sql?
Based on your responses and the other responses to you...
The FIRST step is to define exactly what the above term means.
|
|
|
|