Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mikehaddad
Starting Member
3 Posts |
Posted - 2010-03-01 : 06:54:17
|
| hi i have to copy data from one table to another that r not joined.but i have one column that i the second table that i have to enter via textbox.i mean i have a table customers that has Fname Lname IP....in the second table stooped i have IP Fname Lname....+StoppedDate. i want to copy data from table customers to table stopped and enter the StoppedDate via textbox. and i select the IP by entering it through textbox also i have this code:"INSERT INTO stopped (IP, Fname, Lname, Telephone, Location, TypeofConnection, StartDate, StoppedDate) Values ('" & TextBox1.Text & "', select Fname from customers where IP = '" & TextBox1.Text & "', select Lname from customers where IP = '" & TextBox1.Text & "', select Telephone from customers where IP = '" & TextBox1.Text & "', select Location from customers where IP = '" & TextBox1.Text & "', select TypeofConnection from customers where IP = '" & TextBox1.Text & "', select StartDate from customers where IP = '" & TextBox1.Text & "', '" & TextBox2.Text & "');"i'm getting syntax error:"Syntax error. in query expression 'select Fname from customers where IP = '10.200.50.1''."please anyone can help?mikehaddad |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-01 : 07:25:56
|
| Try this"INSERT INTO stopped (IP, Fname, Lname, Telephone, Location, TypeofConnection, StartDate, StoppedDate) select '" & TextBox1.Text & "', Fname, Lname, Telephone, Location, TypeofConnection, StartDate, StoppedDate from customers where IP = '" & TextBox1.Text & "';"MadhivananFailing to plan is Planning to fail |
 |
|
|
mikehaddad
Starting Member
3 Posts |
Posted - 2010-03-04 : 04:30:22
|
| but i have no StoppedDate in the customers table how should i select it i have to add it in a textbox.mikehaddad |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-04 : 04:38:20
|
| "INSERT INTO stopped (IP, Fname, Lname, Telephone, Location, TypeofConnection, StartDate, StoppedDate) select '" & TextBox1.Text & "', Fname, Lname, Telephone, Location, TypeofConnection, StartDate, '" & StopperDateTextBox.Text & "' from customers where IP = '" & TextBox1.Text & "';"MadhivananFailing to plan is Planning to fail |
 |
|
|
mikehaddad
Starting Member
3 Posts |
Posted - 2010-03-05 : 02:48:04
|
| sorry but not working alsomikehaddad |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-05 : 03:57:27
|
quote: Originally posted by mikehaddad sorry but not working alsomikehaddad
Did you get an error?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|