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 |
|
meetmanthan
Starting Member
2 Posts |
Posted - 2009-08-11 : 09:18:37
|
| Hi.I am having very strang situation. In which I need to use bulk upload. for which I use XML bulk upload insertion. Now the problem is that I need to make an entry in different table for every record. For example:In my record list I am having categoryName, description, TransctionId and etc. which I am passing in XML file format. Now I need to insert categoryName in Category table and After that I need to retrieve that ID from Category table. After that When I am saving records in my transction table, I need to save it with CategoryID,description,TransctionId and etc in it. Every record have different category. I need to do it in single insert. So how can I do that?? |
|
|
meetmanthan
Starting Member
2 Posts |
Posted - 2009-08-12 : 05:12:37
|
| I want to do like this:use TestDatabasedeclare @DeptId as intINSERT INTO [TestDatabase].[dbo].[Users] ([UserName] ,[DepartmentId]) VALUES ('Manthan',[TestDatabase].[dbo].returnDeptID ('DOTNET'))GOwhere [TestDatabase].[dbo].returnDeptID ('DOTNET') is my storeprocedure which is describe as below:create procedure [dbo].[returnDeptID]@departmentName as varchar(50),@deptID as int outputasbegininsert into dbo.Departments (DepartmentName) values(@DepartmentName) select @deptID = DepartmentID from inserted End |
 |
|
|
|
|
|