hi my self avi
i want to copy data from one table to other table,by giving certain
condition and i want o use insert statement .in this i want to pass some
value directly and some value from select statement , if i try i ll get
error i.e all column of destination table (i.e in which i want to insert
data) should match with all columns in values column some thing like
this.
plz give me some helpful suggetion on this 1 10068
"avinash" <pa***********@ rediffmail.com> wrote in message
news:f9******** *************** *******@localho st.talkaboutdat abases.com... hi my self avi i want to copy data from one table to other table,by giving certain condition and i want o use insert statement .in this i want to pass some value directly and some value from select statement , if i try i ll get error i.e all column of destination table (i.e in which i want to insert data) should match with all columns in values column some thing like this. plz give me some helpful suggetion on this
Something like this?
insert into dbo.Table1
(col1, col2, col3, col4)
select 'A', co11, 7, col8
from dbo.Table2
where...
In the SELECT statement, you can mix constant values ('A' and 7) with column
values (col1 and col8) - I think this is what you want to do, if I
understood you correctly. If this doesn't help, then I suggest you post
CREATE TABLE statements for both tables, and the INSERT statement you're
trying to make work, as that will avoid any confusion and guesswork.
Simon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Phil Powell |
last post by:
$sql = 'INSERT INTO fs_usermetadata (' . substr(trim($cols), 0,
strrpos(trim($cols), ',')) .
') VALUES (' . substr(trim($values), 0, strrpos(trim($values),
',')) . ')';
if (!mysql_query($sql)) {
$hasSubmittedUser = 0;
$errorMsg .= $font . '<font color=cc0000><li>Could not insert record
into db</li></font>' .
'</font><p>';
|
by: Christopher Key |
last post by:
Hi,
I currently have a fairly complex query that returns a variable number of
rows, sorted by various criteria. I am trying to insert the result of this
query into an additional table, along with a row number. Ideally, I would
like to be able to do this with an INSERT SELECT statement, although I'm not
sure quite how to achieve this. An example of what I'm trying to achieve
might be:
INSERT INTO tblfinishingpositions (raceid,...
|
by: Jeff Sandler |
last post by:
I need a MySQL select statement as part of a PHP script. I want to find
rows where a certain column either starts with or equals a user-supplied
string. The string will be 1 or more characters in length.
The sending page allows the user to choose which search criteria he
wants, so this (and many other) pieces of the select statement may or
may not be present. The statement always starts with
SELECT * from logdata where driver =...
|
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: 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: JMCN |
last post by:
i received a runtime error message 3346 when i ran the insert into
select code. i have check to see if the query values and destination
fields are the same and it appears so. atlas, i have no idea why my
insert into query does not work. if anyone has suggestions, it would
be appreciated. thanks in advance.
Set db = DBEngine(0)(0)
Set rst = db.OpenRecordset("ETracking")
If rst.RecordCount > 0 Then
|
by: suslikovich |
last post by:
Hi all,
I am getting this error when insert values from one table to another in
the first table the values are varchar (10). In the second they are
datetime. The format of the data is mm/dd/yyyy to be easily converted
to dates. The conversion in this case is implicit as indicated in SQL
Server documentation. Here is my query:
INSERT INTO Campaign (CampaignID, Name, DateStart, DateEnd, ParentID,
ListID)
SELECT ...
|
by: paulmitchell507 |
last post by:
I think I am attempting a simple procedure but I just can't figure out
the correct syntax. My asp (classic) page runs a SELECT query to
obtain dates and ID's from 2 tables
uSQL = "SELECT cal_date, holiday_ID from Calendar, holiday_tbl WHERE
(((calendar.cal_Date) Between . And
.)) And Email_sent=0 AND Staff_ID=" & Staff_ID
This works fine.
|
by: BobRoyAce |
last post by:
Let's say that I am performing a bunch of insert/update queries within
a transaction that is created as follows:
Dim cnn As New
SqlClient.SqlConnection(My.Settings.GRPConnectionString)
cnn.Open()
Dim trx As SqlClient.SqlTransaction = cnn.BeginTransaction()
Further suppose that, in the middle of all of the insert/update
queries, I want to execute a SELECT query against one of the tables
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |