I am trying to insert the table into several relationships with many:
announcement @ TransactionTempTable Table (ID int IDENTITY (1,1) nULL pRIMARY KEY, Opreshnnam Anwarchar (100), Chaluekountaidi Int, Rashiman decimal, execution date date time, rates include value wealth) in @TransactionTempTable (Opreshnnam, Wartmanakountaidi, Rashimoni execution Date, quadrature) Select [Operation Name] as OperatioName, A.AccountID CurrentAcc ountID, dbo.Amount as ([AmountMin], [AmountMax]) AmountMoney as, Dates.item ExecutionDate as, 0 RateValue as ExcelDatabase.dbo.Transactions T Cross apply dbo.GenerateDate from (GETDATE ( ) [rate], [period]) as dated interiors Gurskiy_EconomicApp.DBO.Accounts Join one T.Account = A.AccountName announced @minID int = (sELECT MIN (ID) from @TransactionTempTable) announced @maxID integer = (Announced from Max (ID @TransactionTempTable) announcing @lastID integer declaration @SplitCategories table (category name is not nostril (100)) WHILE (@ minID & lt; = @ MaxID) joined Google in Gurskiy_EconomicApp.dbo.Transactions (currently Sisiaidi, `` the amount Muni, execution date, rate value) Select `current Khatakhol, Rashimoni, execution date, rate value @ TransactionTempTable WHERE ID = @minID SET @lastID = select the @SplitCategories in SCOPE_IDENTITY () iNSERT the Gurskiy_EconomicApp.dbo.fnSplit ((sELECT OperationName fROM @TransactionTempTable WHERE ID = @minID), ',') iNSERT Gurskiy_EconomicApp.dbo.TransactionCategory (transactionId, CategoryID) Do @lastID, @SplitCategories as SC Indoor as C.C.CategoryName = C.CategoryName T @minID = @ minID +1 End Gurskiy_EconomicApp.dbo.Categories Join C.CategoryID
This is my code. I insert the range ID and transaction ID in the transaction category in the table Can not, but the table "Transactions" is filling the right and table categories are also filled. I have just one simple mistake about the display, but in my code I am not getting any fault. Please help plz, this action takes place in my mind at the end of the day. TransactionCategory Table Definition:
Table TransactionCategory (CategoryID does not make an integer zero, transactionId zero not int, constraint transaction_category_pk primary key (CategoryID, transactionId), barrier FK_Category foreign key (CategoryID) reference section (CategoryID), barrier FK_Transaction foreign key (transactionId) reference transactions (transactionId))
you try to insert @lastID, C.CategoryID
in transactions Category
. Is generated from the @lastID
identity, so I think it is different in every move, am I right? However, @lastID
is stable within a single trip, therefore C.CategoryID
should be unique C.CategoryID
Categories
Comes from the table and I also believe that this is P. If there is a duplicate category identifier in this table. Can you confirm this?
This means that due to being with the Categories
to join the duplicate @SplitCategories
. In other words, I think there are duplicates in @SplitCategories
. To confirm this, you can add the following line before entering and we will see:
< Code> select * @SplitCategories from
I think the problem may be in the fnSplit
function. Maybe it's wrongly dividing the operation name
you fnSplit
from
No comments:
Post a Comment