Insert Into Tables
Dec 18, 2007
hello my friends
i have a database with 5 tables : 1-Company 2-Activity 3-Product 4-Project 5-Telephone
each table have a one to many relation with Company Table ! i mean a Company can has many Activities,Products,Projects,Telephones i want to insert in tables at a same time insert into Company table ! i know that i should first insert into company Table and get CompanyID that need to insert in other tables. i hear that i can do this with define a VIEW of joining these tables and use trigger!i dont know how !?
I'll appreciate you to help me :O)
View 4 Replies
ADVERTISEMENT
Apr 9, 2007
Hello
I have a problem with setting relations properly when inserting data using adonet. Already have searched for a solutions, still not finding a mistake...
Here's the sql management studio diagram :
and here goes the code1 DataSet ds = new DataSet();
2
3 SqlDataAdapter myCommand1 = new SqlDataAdapter("select * from SurveyTemplate", myConnection);
4 SqlCommandBuilder cb = new SqlCommandBuilder(myCommand1);
5 myCommand1.FillSchema(ds, SchemaType.Source);
6 DataTable pTable = ds.Tables["Table"];
7 pTable.TableName = "SurveyTemplate";
8 myCommand1.InsertCommand = cb.GetInsertCommand();
9 myCommand1.InsertCommand.Connection = myConnection;
10
11 SqlDataAdapter myCommand2 = new SqlDataAdapter("select * from Question", myConnection);
12 cb = new SqlCommandBuilder(myCommand2);
13 myCommand2.FillSchema(ds, SchemaType.Source);
14 pTable = ds.Tables["Table"];
15 pTable.TableName = "Question";
16 myCommand2.InsertCommand = cb.GetInsertCommand();
17 myCommand2.InsertCommand.Connection = myConnection;
18
19 SqlDataAdapter myCommand3 = new SqlDataAdapter("select * from Possible_Answer", myConnection);
20 cb = new SqlCommandBuilder(myCommand3);
21 myCommand3.FillSchema(ds, SchemaType.Source);
22 pTable = ds.Tables["Table"];
23 pTable.TableName = "Possible_Answer";
24 myCommand3.InsertCommand = cb.GetInsertCommand();
25 myCommand3.InsertCommand.Connection = myConnection;
26
27 ds.Relations.Add(new DataRelation("FK_Question_SurveyTemplate", ds.Tables["SurveyTemplate"].Columns["id"], ds.Tables["Question"].Columns["surveyTemplateID"]));
28 ds.Relations.Add(new DataRelation("FK_Possible_Answer_Question", ds.Tables["Question"].Columns["id"], ds.Tables["Possible_Answer"].Columns["questionID"]));
29
30 DataRow dr = ds.Tables["SurveyTemplate"].NewRow();
31 dr["name"] = o[0];
32 dr["description"] = o[1];
33 dr["active"] = 1;
34 ds.Tables["SurveyTemplate"].Rows.Add(dr);
35
36 DataRow dr1 = ds.Tables["Question"].NewRow();
37 dr1["questionIndex"] = 1;
38 dr1["questionContent"] = "q1";
39 dr1.SetParentRow(dr);
40 ds.Tables["Question"].Rows.Add(dr1);
41
42 DataRow dr2 = ds.Tables["Possible_Answer"].NewRow();
43 dr2["answerIndex"] = 1;
44 dr2["answerContent"] = "a11";
45 dr2.SetParentRow(dr1);
46 ds.Tables["Possible_Answer"].Rows.Add(dr2);
47
48 dr1 = ds.Tables["Question"].NewRow();
49 dr1["questionIndex"] = 2;
50 dr1["questionContent"] = "q2";
51 dr1.SetParentRow(dr);
52 ds.Tables["Question"].Rows.Add(dr1);
53
54 dr2 = ds.Tables["Possible_Answer"].NewRow();
55 dr2["answerIndex"] = 1;
56 dr2["answerContent"] = "a21";
57 dr2.SetParentRow(dr1);
58 ds.Tables["Possible_Answer"].Rows.Add(dr2);
59
60 dr2 = ds.Tables["Possible_Answer"].NewRow();
61 dr2["answerIndex"] = 2;
62 dr2["answerContent"] = "a22";
63 dr2.SetParentRow(dr1);
64 ds.Tables["Possible_Answer"].Rows.Add(dr2);
65
66 myCommand1.Update(ds,"SurveyTemplate");
67 myCommand2.Update(ds, "Question");
68 myCommand3.Update(ds, "Possible_Answer");
69 ds.AcceptChanges();
70
and that causes (at line 67):"The INSERT statement conflicted with the FOREIGN KEY constraint
"FK_Question_SurveyTemplate". The conflict occurred in database
"ankietyzacja", table "dbo.SurveyTemplate", column
'id'.
The statement has been terminated.
at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at AnkietyzacjaWebService.Service1.createSurveyTemplate(Object[] o) in J:\PL\PAI\AnkietyzacjaWebService\AnkietyzacjaWebServicece\Service1.asmx.cs:line 397"
Could You please tell me what am I missing here ?
Thanks a lot.
View 5 Replies
View Related
Apr 22, 2004
Hi,
Currently, I'm using the following steps to migrate millions of records from Foxpro tables to SQL Server tables:
1. Transfer Foxpro records to .dat files and then bcp to SQL Server tables in a dummy database. All the SQL tables have the same columns as the Foxpro tables.
2. Manipulate the data in the SQL tables of the dummy database and save the manipulated data into the SQL tables of the real database where the tables may have different structure from the corresponding Foxpro tables.
I only know the following ways to import Foxpro data into SQL Server:
#1. Transfer Foxpro records to .dat files and then bcp to SQL Server tables
#2. Transfer Foxpro records to .dat files and then Bulk Insert to SQL Server tables
#3. DTS Foxpro records directly to SQL Server tables
I'm thinking whether the following choices will be better than the current way:
1st choice: Change step 1 to use #2 instead of #1
2nd choice: Change step 1 to use #3 instead of #1
3rd choice: Use #3 plus manipulating in DTS to replace step 1 and step 2
Thank you for any suggestion.
View 2 Replies
View Related
Mar 18, 2007
I currently insert into one table with: SqlCommand comm = new SqlCommand("INSERT INTO UsersTable (UserName, Password, Email) VALUES (@person, @pass, @email)", sqlConnection); comm.Parameters.AddWithValue("@person", usrnmeLbl.Text); comm.Parameters.AddWithValue("@pass", hiddenpassLbl.Text); comm.Parameters.AddWithValue("@email", hemailLbl.Text);but I realized that there's another table related to this table and I need to have something go in it so that the users data will be recorded at the same pace. So I tried: SqlCommand comm = new SqlCommand("INSERT INTO UsersTable, FatherHistTable (UserName, Password, Email), (Father) VALUES (@person, @pass, @email), (@father)", sqlConnection); comm.Parameters.AddWithValue("@person", usrnmeLbl.Text); comm.Parameters.AddWithValue("@pass", hiddenpassLbl.Text); comm.Parameters.AddWithValue("@email", hemailLbl.Text); comm.Parameters.AddWithValue("@father", fthrsNmeLbl.Text);Not working, so I am thinking I must do two inserts: SqlCommand comm = new SqlCommand("INSERT INTO
UsersTable (UserName, Password, Email) VALUES (@person, @pass,
@email)", sqlConnection);
comm.Parameters.AddWithValue("@person", usrnmeLbl.Text);
comm.Parameters.AddWithValue("@pass", hiddenpassLbl.Text);
comm.Parameters.AddWithValue("@email", hemailLbl.Text); SqlCommand comm2 = new SqlCommand("INSERT INTO
FatherHistTable (Father) VALUES (@father)", sqlConnection);
comm2.Parameters.AddWithValue("@father", fthrsNmeLbl.Text); Is that the only way to go about it then? Thanks in advance for any explanations.
View 26 Replies
View Related
Dec 19, 2006
Please i need to insert two tables at a time. One is Delivaries and the other is DelivaryDetails. This is the Structure:
DelivariesDelivaryId...........Int Primary Key IdentityDelivaryNo.........nvarcharDelivaryDate......datetime
DelivaryDetailsDelivaryId............Int Primary Key Foreign KeyProductId............Int Foreign KeyQty....................Int
I have created a StoredProcedure named InsertDelivaries
CREATE PROCEDURE InsertDelivaries@DelivaryId int output,@DelivaryNo nvarchar(20),@DelivaryDate datetime
AS
insert into Delivaries values(@DelivaryNo,@DelivaryDate)
but this does not insert the records as expected. Please help
View 5 Replies
View Related
Apr 10, 2007
hello..
I think this is common question, but i still dont get answer from all past topic and thread.
My problems is:
I have two tables,
1) company_info (com_ID(Primary key with increment int), name, add, contact_no)
2) company_detail(com_ID(Primarykey without increment), product, quantity)
I want capture the data com_ID from 1st table and at the same time I want to insert into 2nd tables. How the way??
currently I do in table adapter in data set.
I also looking how to use store procedures? my knowledge about store proceduree is zero and really need articles or tutorial from any website. anylink?
One more things, I also which part i should do the relationship, in dataset or at database diagram?
I really lack in this database knowledge
Thank you
View 3 Replies
View Related
Feb 22, 2008
I am using Framework 3.5 with VS2008 writing VB code to put and get data in a SQL 2005 Server database.
How to fill out a form, and on one submit button click, send some information into one database table and different information into a different table?
Those tables of mine have a common key, but one is about where and when and what work needs to be done and the other is about authorization, departments and funds.
I’d just think that I should be able to do that in one InsertCommand="INSERT INTO …� statement and not have to code a whole new <asp:SqlDataSource ID="SqldsDOIT" runat="server" interface for the second table … which is the work-around that I can do … it just seems ignorant to me, when we are told to keep like-things in separate tables (normalization).
In other words, the following fails to run ... if I only INSERT INTO Job( or only INSERT INTO Signatory( ... it's all good.A little help please. I've scanned through the forums, but not found exactly this addressed. <asp:SqlDataSource ID="SqldsDOIT" runat="server" ConnectionString="<%$ ConnectionStrings:DOITWorkOrderConnectionString %>" SelectCommand="SELECT FROM [Job] JOIN [Signatory] ON Job.Jobnumber = Signatory.Jobnumber" InsertCommand="INSERT INTO Job(Datereq, ..., Jobcomm) VALUES(@Datereq, ..., @Jobcomm) INTO Signatory(BillProgram, ..., Sigemail) Values(@BillProgram, ..., @Sigemail)"> <InsertParameters>
View 4 Replies
View Related
Sep 5, 2001
I want to insert records from two tables into one table as the record is concatenated from both the tables and then put it into the one table.
How can we do that so that i can take the records from the one table..?
CREATE PROCEDURE SP_P31
AS
select 'CA'+'|'+COMPANY+'|'+COMPANYNAME+'|'+CUSTOMERNUMBE R+'|'+COMPANYPHONE
+'|'+COMPANYFAX+'|'+FEDTAXID+'|'+DUNSNUMBER+'|'+S1 099+'|'+DUNSSUFFIX+'|'+convert(char,ADDRESSSEQ)
+'|'+COUNTRY+'|'+ADDRESSTYPE+'|'+ADDRESS1+'|'+ADDR ESS2+'|'+ADDRESS3+'|'+ADDRESS4
+'|'+CITY+'|'+STATE+'|'+ZIP+'|'+FAXNUMBER hello1 into temp32
from v4
select 'CT'+'|'+COMPANY+'|'+CONTACTNAME+'|'+CONTACTTYPE+' |'+CONVERT(CHAR(10),CONTACTADDRESS)
+'|'+PHONE+'|'+FAX+'|'+TITLE hello INTO temp32
from v3
View 3 Replies
View Related
Mar 8, 1999
Does SQL allow you to insert data into 2 related tables simultaneously?
I have a form where the user enters in Name, Age, SocialSecurity,
Address. The Address table is a separate table than the Individual
table. How do I insert into both ??? Both tables are tied with a unique Individual_ID which is system generated.
I am using a stored procedure
Thanks alot!!
Joyce
View 1 Replies
View Related
Oct 19, 2007
I posted this question previously but am now getting another error and fixing it (months ago). I am trying insert The ID2 column (pk) from table 2 into ID2 column (fk) of table 1. What the T-SQL is trying to do is check to see if the record in table 2 already exists in then just pass the value to the insert query for table 1. If the record does not exist then insert data into table 2first then perform the table 1 insert.
This SP works fine if the user does not exist in table 2. However, if the user does exist in table2 then instead of passing the ID, a null value is passed.
Can anyone tell me why the first query does not work? If there is an easier way of doing this then I am all ears.
Thank you
DECLARE @IdentityHolder int
BEGIN TRANSACTION
IF EXISTS (SELECT ID2 FROM [tbl2] WHERE ID2 = @ID2)
BEGIN
(SELECT ID2 FROM [tbl2] WHERE ID2 = @ID2)
END
ELSE
BEGIN
INSERT INTO [tbl2] ([ID2], [FN], [LN], emailAdd])
VALUES ( @ID2, @fName, @lName, @emailAdd)
END
COMMIT
SET @IdentityHolder = (ID2)
INSERT INTO [tbl1]([ID2], [event])
VALUES (@ID2, @event)
View 14 Replies
View Related
Dec 12, 2007
Hi i have a stored prodedure which inserts into a local table then inserts into a remote table this works fine, what i need to do is.
INSERT ONTO TABLE A
THEN GET THE MAX(ID) OF THE RECORD INSERTED
THEN INSERT THAT MAX(ID) INTO TABLE B
i have created a parameter called @WebID but how do i give it the value of the MAX(ID) before i insert into tableB
Many thanks
View 2 Replies
View Related
May 18, 2008
Good evening every body.
I have 3 tables ( customer, product and order).
Customer table contain customer_id as a primary key
Product table contain product_id as a primary key
Order table contain both customer_id and product_id
I want to insert the values from customer and product to order.
Any help?
View 7 Replies
View Related
Feb 7, 2008
I want to compare two tables. if the data is existed to the other table i will insert it to other table if not exist it will load also to diffrent table.
Example: if my table was Tbl_StudentID and Tbl_FacultyID i want to insert in tbl_Grade if the data in Tbl_StudentID is exist or present in Tbl_FacultyID . And if the Tbl_StudentId is not exist in Tbl_FacultyID the data will move to Tbl_SupervisorID.
Please Help..
View 3 Replies
View Related
Jun 30, 2006
Coming from an asp world, I am totally lost on this one.
I have two tables.
tblUsers and tblUserInfo
I have a gridview that gives me the list of users and when selected, it gives me the detailsview of the the record. However, When I need to add a new user, I am trying to add that user into tblUsers (which happens with no problems), and then add a record, using the same user number (UserID) has the key or ID for the tblUserInfo.
So basicly, when I create a new user in tblUsers I want to create a record in tblUserInfo with the same userid.
In ASP, this takes me minutes... I have been trying to figure this out for weeks.
vs2005, sql express.
Thanks.
View 1 Replies
View Related
Feb 6, 2007
Hi, I have some problem with inserting data into two separate table which are connected via foreign key like in this example:Students (id_s, name, id_subject)Subjects (id_subject, name)So the point is to add a new student and subject for that chosen student. You have to make two inserts right? but how to pass the primary key to the table with foreign key? The form consists of three texbox: name, name_of_subject. Both id_s and id_subject are increment automatically. Any idea how to do it? I would be very grateful for the working code.Thanks in advance and best regards,N.
View 5 Replies
View Related
Oct 16, 2007
I have 3 tables, Type, Subtype, and Subtype2. All which are related by the ID of preceding table. Using a 3 textboxes and a button I want to insert new Types and subtypes to the tables. How do I go about identifying the new types new ID insert it in to the other tables? I am using ASP.net (vb) with sql server.
View 3 Replies
View Related
Nov 25, 2007
Hi,I need to make an insert into two tables connected to each other via foreign and primary key. The point is - I cannot use stored procedures or triggers. That tables looks like this: Candidate(ID, Name, Surname, Class) and Candidate_Exam(ID, date). ID in Candidate_Exam is a foreign key. When you insert a new record into Candidate, another one need to be inserted into Candidate_Exam with the same ID. Can anyone help? It is supposed to be an easy assigment so maybe I just have a bad approach.Regards,N.
View 3 Replies
View Related
Apr 22, 2008
Hi i want to insert a tables from one database to another based on unique key
View 2 Replies
View Related
May 12, 2008
Hi,
I'm trying to update 2 tables in SQL (say 2 Costumers table). 1 Lists all costumers per location( so 1 costumer can be placed in multiple locations), while the other is by location with contact details.
Is it possible for me to update both pages in 1 web update page?????
Thanks in advance.
View 3 Replies
View Related
May 12, 2005
hi,
i have got a problem, iam creating an asp.net application, but i pretend to insert data in two different tables, but i have no ideia how to do this.Can you help to solve this problem? please..........
View 3 Replies
View Related
May 12, 2005
hi,
iam creating an asp.net application the database is created on the SQLSERVER, but i have a problem, i pretend to insert data in to 2 tables and i have no ideia how to do this. Can you help me to solve this problem? Please.....
View 1 Replies
View Related
Jun 6, 2006
Hi I was watching this beginner webcast
Lesson 8: Obtaining Data from a SQL Server 2005 Express Edition Database
http://msdn.microsoft.com/vstudio/express/visualcsharp/learning/#beginners
I tried to do the same exact thing.
But when I tried to insert data in the newly created table I got the follwoing error window:
Invalid value for cell (row1, column 2)Then changed value in this cell was not recognized as valid..Net Framework Data Type: Byte[]Error Message; You cannot use the Result pane to set this Field data to values other than NULL.
Type a value appropriate for the data type or press ESC to cancel change.
Any Idea why thing happing.
View 3 Replies
View Related
Jun 13, 2006
Need some help. In my db I created 3 tables. 1- tblClient 2- tblCategories 3- tblClient_Cat ( colums: 1) client_id 2) cat_id).What I'm trying to do is create a sp to insert data from a web form into the tblClient and into the tblCat using the same sp. this is all I got so far.CREATE PROCEDURE [usp_insetClient](@ClientName varchar(25),@Contact varchar(100),@Tel char(13),@Fax char(13),@WebAdd varchar (250),@email varchar(250),@CatID int) ASBegininsert tblClient(Client_name,client_contact,Lient_tel,client_fax,client_webadd,client_email)values(@ClientName,@Contact,@Tel,@Fax,@WebAdd,@email)select @@identityinsert tblclient_cat(cat_id,client_id)values(@Catid,@@identity)(I tried to use this sp but didnot work)as you can see I need help inserting the client_id just created by the db into the tblclient_cat since the cat_id is passed from the web formThanksErnesto
View 1 Replies
View Related
Aug 3, 2001
i need to insert data into 2 tables. first in one, and the id of the register i just inserted is a field from the register in the other table (+ other data). inserting in this 2 tables should be invisible to the user so it has to be done automatically.
the dumb way i guess would be using 2 ADODB.recordsets (rs,rs1). first insert in one store the id in a var (after rs.update, rs.movelast, var=rs.fields("id")) and after this inserting a register in the new recordset (rs1)
is there a better way to do it?? any ideas??
thanx
View 2 Replies
View Related
Aug 6, 2007
hi guys,
can someone please tell me the best ways to insert data into multiple related tables .
cheers guys
andy
View 2 Replies
View Related
Oct 18, 2006
Hello
for MS SQL 2000
I am having MyTable with 7 columns : A,B,C,D,E,F,G
i want to
INSERT INTO myTable
SELECT A,B,C,D FROM FirstTable WHERE FirstTable.ID > 100
and the columns E,F,G :
E = 1
F = SELECT Max(ID) AS F FROM SecondTable
G = 0
how can i do it ?
i would like to create a stored procedure
thank you
View 2 Replies
View Related
May 20, 2008
Hi, i need to create a stored procedure that will take data from one table and insert it into one tabe.
I have 3 tables
tblTest is the table that i need to take the informations from.
intD1 to intD4 is a score
I don't know if iexplain my sefl correctly tks in advance!
tblTest
1 , 2 , 'A', 'B', 0 , 1 ,2 , 4
i need this
tblResultat
1, 2, 'A','B'
tblResultatXReponse
1,1,0,0
2,1,1,1
3,1,2,2
4,1,4,3
tblTest
intTestId autonumber
intCoursId
strCodeAbsent1
strCodeAbsent2
intD1
intD2
intD3
intD4
tblResultat
intResultatsId autonumber
intCoursId
strCodeAbsent1
strCodeAbsent2
tblResultatXReponse
intResultatXReponseId autonumber
intResultatsId
intReponseDesc
intOrdre
View 5 Replies
View Related
Oct 30, 2013
I have those 3 tables (sales,source, sales, sales_details),
Sales_source (table)
id, name
1 Office
2 Post
3 Web
Sales (table)
id, saleid, customer, source, date
01, 230, bill din, 1, 2013-10-22
Sales_details (table)
id, saleid, object, delivery, date
01, 230, card, no, 2013-10-23
02, 230, box, yes, 2013-10-24
03, 230, car, no, 2013-10-31
And I want to create if is possible one insert command
And make the user complete the details of Sales_details (that they have inner join for the sales_source table so he can see only the sales_source_name and behind the sales_source_id to be stored)
And after to be able to add in as many [sale_details] he need for the select sale…
Is this possible to be done with one command ???
I think is not possible as i have made a small research on the web, and i will need to make one insert for the sales (table) independent and after to programming i guess a way to open the sale_details and add the rest….
View 3 Replies
View Related
Oct 11, 2006
Hi,
I am using sqlServer 2000.I want to insert as well as update Two Tables at the Same Time using storedprocedure.Both My Tables Have the Same columns only difference being the name.My Tables are,
ADDRESS AND ADDRESSBOOK and their values are Name, Address, Place,
Date,City.
How can achieve this task using stored Procedures.?
Any Help would be appreciated....
Thanks...
View 8 Replies
View Related
Jul 23, 2005
Three tables (all new, no data) will receive data from dBase and betransposed into them...All three have auto generated IDENTITY columnsand pk and fk constraints. Can someone provide me with anunderstandible sample?Thanks,Trint
View 3 Replies
View Related
Apr 7, 2008
I understand the basics for doing an insert. Their seems to be many ways of achieving the same thing in .net. I have used the tableadpaters and sqlcommand functionality to achieve this. My one question is how foregin keys should be created in associated tables. EG so if i create a new record entry in one table and the primary key for that entry is a foreign key in another table, do I need to call 2 table adapters, or run 2 sqlcommands(taking the primary key from the first traction and use this in the next transaction)?
Any help or direction for some good tutorials on this would be much appreciated.
Thanks
Mark
View 4 Replies
View Related
Nov 16, 2007
hi all ,
I need to get data from textboxes and insert data into 2 tables. I tried as following code but it didn't work..
TextBox6 is primary key for Book and it's auto number field at access database ( So, if i run "cmd = New OleDbCommand(str, cn)" then data will added to other colume and the primary key will auto create .) .
But I need to insert the data into Inventory too using same button . B_ID is foreign key in Inventory to connect with Primary Key (which is Book_ID) at Book. How can I insert data into those 2 table using vb.net ? Thanks in advanced and will appreciate if you could provite the code sample too .
---
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim cmd2 As OleDbCommand
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C: estdb.mdb;")
cn.Open()
str = "insert into Book(Title,Arthur,Publisher,Year)" + " values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "')"
Dim str2 As String = "insert into Inventory(B_ID,Price,Quantity)" + " values (" & TextBox6.Text & ",'" & TextBox7.Text & "','" & TextBox8.Text & "')"
cmd = New OleDbCommand(str, cn)
cmd = New OleDbCommand(str2, cn)
cmd.ExecuteNonQuery()
cmd2.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message) 'catch error
End Try
cn.Close()
Call EnableReadOnly()
End Sub
View 11 Replies
View Related
May 8, 2008
I have timecard records need to be inserted into the EMP_TC table automatically. This job should run every day to create EMP_TC records for the full current month for any ASSIGNMENT_ID€™s where ASGNMT_END_DATE is either null or greater than the run date of this job and PRD_START_DATE is in the current run month.
PRD_START_DATE is always Sunday, PRD_END_DATE is always Saturday. For example, if an employee starts a new project on 4/8/2008, the first timecard record in EMP_TIMECARD for that EMP_ASGNMT_ID should be 4/6/2008 €“ 4/12/2008. If PRD_END_DATE is null then the job would populate the following 4 records for the EMP_ASGNMT_ID:
i have currently stored procedure doing this but i had to specify the dates manually .how could i automate this process.
i can avoid stored procedures needed but i am really confused on what logic to apply to it.
We need to pick the assigment id and dates automatically from employment assignment table.
Assignment id is nothinb but a identity coloum please advise
please advise
View 3 Replies
View Related