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 |
|
muzzettemm
Posting Yak Master
212 Posts |
Posted - 2009-08-26 : 23:33:53
|
| CREATE PROCEDURE InsertHoursasINSERT INTO (TanfActivity_tbl.[Earned hours], TanfActivity_tbl.[Purpose of Contact], TanfActivity_tbl.[Type of Contact], TanfActivity_tbl.[Catagory for hours], TanfActivity_tbl.[Services Covered], TanfActivity_tbl.[State Catagory], TanfActivity_tbl.[State Services Covered])SELECT People_tbls.[Parent First Name], People_tbls.[Parent Last Name], TanfActivity_tbl.[Type of Contact], TanfActivity_tbl.[Purpose of Contact], TanfActivity_tbl.[Referral Date], TanfActivity_tbl.[Earned hours], TanfActivity_tbl.[Catagory for hours], TanfActivity_tbl.[Services Covered], TanfActivity_tbl.[State Services Covered], TanfActivity_tbl.[State Catagory]FROM TanfActivity_tbl INNER JOIN People_tbls ON TanfActivity_tbl.[Parent ID] = People_tbls.[Parent ID] |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-08-27 : 00:06:03
|
| Hi,Can u explain clearly, what is ur requirement |
 |
|
|
muzzettemm
Posting Yak Master
212 Posts |
Posted - 2009-08-27 : 02:44:47
|
| like a Ditto KeyHello Madhu I guess what I want to do is an Update. See lets say the user has to to put in the same data but for different records. What I wanted to do is create a procedure that would update or insert a new with the information and append it to the TanifActiivty Tabl which has a one to many relationship with the parent table. So if the user does a search for the Last Name or First name Or by the Parent ID (which) and in the [Catagory for hours] and the Purpose of contact and the [Earned hours] , [Catagory for hours], [Services Covered] then they would go to the next record and just append the same data into those fields. I am just trying to save time on allot of data entry. I hope that makes senseCREATE TABLE [dbo].[TanfActivity_tbl]([ID] [int]IDENTITY(1,1) NOT NULL,[Contact Date] [datetime]NULL,[Parent ID] [nvarchar](50) NULL,[Type of Contact] [nvarchar](50) NULL,[Purpose of Contact] [nvarchar](max) NULL,[Referral Date] [datetime]NULL,[Earned hours] [float]NULL,[Catagory for hours] [nvarchar](255) NULL,[Services Covered] [nvarchar](255) NULL,[State Catagory] [nvarchar](255) NULL,[State Services Covered] [nvarchar](255) NULL,[Month] [nvarchar](50) NULL,[Week] [nvarchar](50) NULL,[DateReferredBack] [datetime]NULL,[DateOfCall] [nvarchar](50) NULL,[Notes] [ntext]NULL,[DateofPostCard] [datetime]NULL,[SCAIRCaseWorker] [nvarchar](50) NULL, CONSTRAINT [PK_StateActivity_tbl] PRIMARY KEY CLUSTERED ([ID]ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]which is has a one to many relationship with the People_tblsCREATE TABLE [dbo].[People_tbls]([Parent ID] [nvarchar](50) NOT NULL,[Family ID] [nvarchar](50) NULL,[Date of Referral] [nvarchar](50) NULL,[Parent First Name] [nvarchar](50) NULL,[Parent Last Name] [nvarchar](50) NULL,[Parent SS#] [nvarchar](50) NULL,[Telephone #] [nvarchar](50) NULL,[Message #] [nvarchar](50) NULL,[Address] [nvarchar](50) NULL,[City] [nvarchar](50) NULL,[State] [nvarchar](50) NULL,[Zip] [nvarchar](50) NULL,[E Mail Address] [nvarchar](50) NULL,[Tribal Affiliation] [nvarchar](50) NULL,[Event ID] [nvarchar](50) NULL,[TANF staff making Referral] [nvarchar](50) NULL,[Type Participant] [nvarchar](50) NULL,[Weekly Hrs] [int]NULL,[Mo Hours] [int]NULL,[Special Instrution] [nvarchar](max) NULL,[Referral Status] [nvarchar](255) NULL,[Service Area] [nvarchar](255) NULL,[ScannedDocuments] [nvarchar](50) NULL,[PeopleID] [int]IDENTITY(1,1) NOT NULL,[DOB] [datetime]NULL,[Age] [numeric](18, 0) NULL,[____] [nvarchar](50) NULL, CONSTRAINT [PK_People_tbls] PRIMARY KEY CLUSTERED ([Parent ID]ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY] |
 |
|
|
|
|
|
|
|