Insert into multiple tables


hi i am using dreamweaver to create a insert record in to a table.

but i need to insert the data into two tables.

i am a newbie so is there a way to acheive this

Posted On: Tuesday 20th of November 2012 03:12:45 AM Total Views:  439
View Complete with Replies

RELATED TOPICS OF Microsoft SQL Server PROGRAMMING LANGUAGE




Temporary tables

, I have a java application that is running on Oracle and we would like to port it to sql server 2000. In oracle we are using global temporary tables with an option to delete all rows on commit. I saw that sql server has a similar concept of local temporary tables but it is not quite the same. It gets deleted when the connection is closed. I would like data to be deleted when the transaction commits. The local temporary table is visible per connection but since we do not close connection, a connection can be associated with more than a single java session. What is the best way for me to mimic Oracle's global temporary tables with delete on commit; So what I would like is to have a table which has all data deleted on commit and the table with data that is only visible per connection Thank you
VIEWS ON THIS POST

118

Posted on:

Tuesday 20th November 2012
View Replies!

It wont delete multiple records from SQL Server 2005

Ive been trying to get this working all day and i cant figure out where im goin wrong, im new to asp and now i really need help. Well basically i have a database setup in SQL and i have one page that displays the information and then a checkbox at the end of it so when they click that box then click the button delete it will delete the record. the page that displays the records includin the checkbox is below(this page is called Admin_Accounts.asp): Code: Admin Accounts Welcome Admin: Back | Log Out   # Username Password First Name Last Name Actions Edit   Add Record << Prev << Prev allrecords pagelistcounter = pagelistcounter + 1 %> Next >>Next >> then when you click the delete button it will then run the script Admin_Delete.asp, the code for this page is shown below:
VIEWS ON THIS POST

154

Posted on:

Tuesday 20th November 2012
View Replies!

Check for duplicate data before insert

I am currently doing an insert based on a selection from another table in a query within DTS. Before I do the insert I will like to check to make sure that the data is not already in the database. I want to do this check based on 2 fields. Does anyone have a good solution in achieving this
VIEWS ON THIS POST

154

Posted on:

Tuesday 20th November 2012
View Replies!

Creating query against two tables

stepdefinition has steptype flowid stepid task has taskid flowid stepid flowid and stepid for both tables match; meaning that if i found a record in task with a certain taskid, i could query stepdefinition with the same flowid and stepid to find the steptype. well, i wanna do it the other way around. I query stepdefinition to find a list of flowids and stepids for a specific steptype. select flowid, stepid from stepdefinition where steptype = -3 Now, I want to find all taskids in task for each flowid/stepid combination here's a visual
VIEWS ON THIS POST

209

Posted on:

Tuesday 20th November 2012
View Replies!

link two tables in two different mdf files

i have two tables in two different mdf files each (under one MSDE instance). I would like to make a rational link between these two tables in VB6. Any suggestion
VIEWS ON THIS POST

207

Posted on:

Tuesday 20th November 2012
View Replies!

concatenation of values from multiple rows in a single row

In my stored procedure, I get the following values in my temporary table: router 1 | 172.10.1.1 | response_time router 1 | 172.10.1.1 | port speed router 1 | 172.10.1.1 | bits/sec I want to collapse this into a single row like this: router 1 | 172.10.1.1 | response_time, port speed, bits/sec Basically I want to find if the first and second column values repeat, then I want to concatenate the third column with comma and return a single row. Can someone please tell me how to do this
VIEWS ON THIS POST

223

Posted on:

Tuesday 20th November 2012
View Replies!

Help! SQL insert

hey i'm really furious abt tis. i don know wat is wrong with tis sql insert statement but whenever i execute it says tat syntax error in insert into statement: > strSqlCmd = "INSERT INTO VENDOR " & _ "(Name,Address,Club,Phone,Email,UserName,Password) " & _ "VALUES ('" & strCName & "','" & strAddress & "','" & _ strClub & "','" & strPhone & "','" & strEmail & "','" & strUName & "','" & _ strPwd & "')" > > tis is my statement
VIEWS ON THIS POST

211

Posted on:

Tuesday 20th November 2012
View Replies!

Displaying multiple results in one row

Here's what my table looks like (1st Table) ID | Name -- |------ 1 | violato 2 | Steve (2nd Table) ID | Hobby ---|------ 1 | Basket 1 | Pool 1 | Soccer 2 | Tennis 2 | Golf And I want it to be displayed as: ID | Name | Hobby ---|------|-------------------- 1 |Violato|Basket, Pool, Soccer ---|------|-------------------- 2 |Steve |Tennis, Golf ------------------------------- So basically put all my hobbies in one column separated by , instead of one row on every hobby and duplicate all my name over and over again. I DO understand this can be done with MySQL by using GROUP_CONCAT() BUT i'm using MS SQL and I've been trying couple hours to fix it. This is an ASP.NET application is built on VB.NET using dataset and datatable if that matters.
VIEWS ON THIS POST

220

Posted on:

Tuesday 20th November 2012
View Replies!

cross referencing tables

, i am wondering if someone can help me with a sql script that would help me cross reference data from one table vs another. what i need to show is .. which qty's from one table matches the other qty field in the other table that has a similar .. either description and or +1 to -1 months on the date range this is from my table called "physical" product_idqtypo_numberdate_purchased332ERP0005530/01/2004611ERP0005530/01/2004685ERP0005530/01/2004625ERP0005530/01/200470530/01/20046631/07/2002816NS45028/09/20013910NS45028/09/2001425INV I448442 (Fujitsu)31/05/2001 this is from my table called "bart" po_numberdate_purchasedLocationQtyNS57926/06/200226RO-62526/06/200225JO-38826/06/200241ME58226/06/200216210WO26/06/2002WO26BH-016 ERP0009918/05/2004BH38BH-016 ERP0009918/05/2004BH13814/05/20031512/06/2003213/02/20043ERP0007830/03/20042 and this is from my other table called "invoices" product_idqtypo_numberdate_purchased816NS45028/09/20013910NS45028/09/2001425INV I448442 (Fujitsu)31/05/2001103019/11/200113319/11/2001293019/11/20016426NS57926/06/2002 and hopefully do another query where my "invoices" table can be verified against both. did this make any sense in the end, i looked for invoices and put them into the db, i also got data from our vendor (hense the name bart) and then looked at the physical licenses. i put all this data into the db and just need to cross reference all of them
VIEWS ON THIS POST

132

Posted on:

Tuesday 20th November 2012
View Replies!

DTS - using multiple data sources

How do I use a view or query that references two different data sources ie 1 Oracle (APPPCT_PROJECT_TYPE ) and 1 table within my Sql. (ProjectTypes) I want to use a query that looks and the data in the Oracle table compares it against my current table to determine if there are differenes and if so update current table with the differences in the data. This is the query I would have used in Access: Help me to convert it use using DTS. INSERT INTO ProjectTypes ( ProjectTypeCode, ProjectTypeDescrip, ProjectCatagory, ProjectClass, CapitalProjectNum, DateCreated, UserCreated, DateModified, UserModified ) SELECT APPPCT_PROJECT_TYPE.ID, APPPCT_PROJECT_TYPE.DESCR, APPPCT_PROJECT_TYPE.PROJ_DESCR_CATEGORY, APPPCT_PROJECT_TYPE.PROJ_CLASS, APPPCT_PROJECT_TYPE.CPN, Now() AS Expr1, "import" AS Expr2, Now() AS Expr3, "import" AS Expr4 FROM APPPCT_PROJECT_TYPE LEFT JOIN ProjectTypesON APPPCT_PROJECT_TYPE.ID = ProjectTypes.ProjectTypeCode WHERE (((ProjectTypes.ProjectTypeCode) Is Null)); Any assistance in this mater is greatly appreciated. Sincerely, Karen
VIEWS ON THIS POST

357

Posted on:

Tuesday 20th November 2012
View Replies!

Handling Special character before inserting through XML (In Asp .Net)

Hi To convert the Special character i am using htmlencode but it is not handling the Single Apostropes For eg: Dim strremarks = server.HtmlEncode(txtsample.text.trim) if the Txtsample.value='Anit'ha' how to handle this
VIEWS ON THIS POST

188

Posted on:

Tuesday 20th November 2012
View Replies!

Script to insert 1000 rows in a database table

Please guide me as to how to write a script to insert 1000 rows in a table automatically for SQL Server. the table has structure like Table1(id int,name varchar, date datetime,currency money) Thanx in advance.
VIEWS ON THIS POST

234

Posted on:

Tuesday 20th November 2012
View Replies!

Urgent! Please help. Can't insert!

I am running SQL2000 on W2k server. Everything was working fine untill sometime yesterday. in a sudden, I was not able to insert into my database table. I can do select, and I can even run sp_columns on the table, but when I try to INSERT, I get the following error ... Server: Msg 208, Level 16, State 3, Line 4 Invalid object name [tablename]. The insert statment should be working fine as they were run before the problem occurs! Has anyone ran into this before Any input is appreciated!
VIEWS ON THIS POST

190

Posted on:

Wednesday 21st November 2012
View Replies!

Insert data into 2 tables in a single shot

Hi , In SQL Server, Can we load data into two table from a single table in a single shot something like we do it as below: select * into from IS there any way to achieve this
VIEWS ON THIS POST

217

Posted on:

Monday 26th November 2012
View Replies!

Help on stored procedure that inserts & selects

hello, I'm working on a page that has a grid and a calendar. I want to have the grid display data based on what the user clicks in the grid. It could be one day or many days. I had a store proc that selected records and it worked alright, if the data was already there. The problem is when I don't have the data there. ( This is a timesheet app and I know my design might not be great - hence my problems). Anyway, I was trying to combine an insert and select into one store proc, thinking this could help me, but it seems like it only helps me when I have one row of data - unless you know how to do this. How do I make my SP insert work when there is a range of dates Maybe not possible...... Here's my code Code: ALTER PROCEDURE dbo.TESTING ( @PRESENT int, @TSKey int , @Tdate datetime, @TotHours int, @Amend datetime , @beginTime as datetime, @endTime as Datetime ) AS IF ( @PRESENT =1 ) BEGIN --TEST INSERT INTO TIMEDATA (tkey,TDate) values (@TSKey,@Tdate) where ( tdate = @beginTime) --this does not work where tdate > @begindate and tdate < @enddate END ELSE BEGIN UPDATE TimeData SET TotHours = @TotHours , AuthAMend = @AMend where tkey = @tskey and TDate=@Tdate END
VIEWS ON THIS POST

235

Posted on:

Monday 26th November 2012
View Replies!

Finding Auto ID during "insert into"

Not sure if this is the right place, but I figure if you know SQL you'll know this. I'm inserting data into a DB from a form. The DB is auto-incrementing the ID #. Thing is, I need to know what that ID is on the same page as the insert comand. As I'm writing I'm thinking that I need to run a query that tells me how many records are in the table after the insert query and that should tell me what the last id was, yes Is there a better way to do it T.I.A.
VIEWS ON THIS POST

233

Posted on:

Monday 26th November 2012
View Replies!

How insert string into dtb

I use this statement to insert string value in my test dtb is it correct Code: strSql = "UPDATE guestbook SET" _ & " isapproved = '1'" _ & " WHERE gid =" & arr_idcount(c)
VIEWS ON THIS POST

190

Posted on:

Monday 26th November 2012
View Replies!

can't insert data into mssql through my asp code.. :(

hi here's my asp code: Code: i can successfully connect to my database, but it seems i can't insert the data i want into it. Every time i execute the script, the following message appeared: Code: Error Type: (0x80040E07) /mcrs/store_registration.asp, line 24 line 24 here refers to Code: set R = conn.execute(strSQL) could anyone tell me where i went wrong any help is greatly appreciated.
VIEWS ON THIS POST

250

Posted on:

Monday 26th November 2012
View Replies!

How to insert a banner between news?

I get a news-list with 4 items back from a SQL-query. That already works fine. Now I want to insert a banner after the 2nd news. Let's keep it simple, if blnBanner = true then how can I do it
VIEWS ON THIS POST

182

Posted on:

Monday 26th November 2012
View Replies!

View over multiple databases

i have 2 databases (on 1 instance of sql server) i would like a view in database A bases on data in database B 1) is this possible 2) if yes, how do i do this 3) how are permissions and user involved
VIEWS ON THIS POST

235

Posted on:

Monday 26th November 2012
View Replies!