How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask ATLPROG Your Own Question

ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7677
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
44910485
Type Your Programming Question Here...
ATLPROG is online now
A new question is answered every 9 seconds

U ONLY Ingo, I would like to add another table to the

Customer Question

FOR INGO U ONLYHello Ingo,I would like to add another table to the routine you previously created.
Submitted: 10 months ago.
Category: Programming
Customer: replied 10 months ago.
I should have said I would like to create another UPDATE routine that will include the new table.Let me know if you have any questions.
Expert:  Ingo U replied 10 months ago.

Hello, welcome back and thanks for requesting me. I will be happy to look into your request tomorrow.

Expert:  Ingo U replied 10 months ago.

I'm sorry can you explain what you need? Some parts of some of the files you sent look familiar, others don't - I need some direction as to what you're after.

Also I struggle every time with the importing of your CSV files, at least because they contain double quote characters, it's tedious and in the end I'm never quite sure if I'm getting everything.

Can you just upload a backup of your database as a single file which I could restore in one step and be looking at the same table schema and data? Then, tell me what you're trying to achieve.

You could create the single database backup file (.dat) and upload it to wikisend, for example.

Customer: replied 10 months ago.
I have about 30 tables in DB. I think I would have to back them all up to? Might be a large file.I’m trying to get this UPDATE to work with the FROM below just like you did with 2 tables - now I have 3./*--------------YOUR UPDATE ---------------*/UPDATE [Volusion_WCL_Categories]
SET [CategoryDescription] = convert(nvarchar(max),[CategoryDescription]) +''+ [Volusion_Product_Attributes].[PTR_Thermal_DTTT] + '"' + [Volusion_Product_Attributes].[PTR_Thermal_Print_Width]
+ ''' ' + [Volusion_Product_Attributes].[PTR_Thermal_DPI] + '' + [Volusion_Product_Attributes].[PTR_Thermal_Connections] + '' + [Volusion_Product_Attributes].[PTR_Thermal_Options] + '"' + [Volusion_Product_Attributes].[PTR_Thermal_Options] + '' + [Volusion_Product_Attributes].[PTR_Thermal_Options] + ''+
'' + [Volusion_WCL_Products].[productcode] + '
Same Day Shipping On Orders Before 2:00pm CST $' + CAST([Volusion_WCL_Products] .[productprice] AS VARCHAR) +
'
Per CartonAdd To Cart'/*-------------------With This From----------------------*/FROM
[DistributorFeeds].[dbo].[Volusion_WCL_Categories] [Volusion_WCL_Categories]
INNER JOIN [DistributorFeeds].[dbo].[Volusion_WCL_Products]
[Volusion_WCL_Products]
ON [Volusion_WCL_Categories].[categoryid] =
LEFT ([Volusion_WCL_Products].[categoryids] ,
3)
INNER JOIN [DistributorFeeds].[dbo].
[Volusion_Product_Attributes] [Volusion_Product_Attributes]
ON [Volusion_WCL_Products].[productcode] =
[Volusion_Product_Attributes].[productcode]
WHERE
([Volusion_WCL_Categories].[categoryid] = 136) OR
([Volusion_WCL_Categories].[categoryid] = 135)
ORDER BY
[Volusion_WCL_Products].[productcode] ASC
Customer: replied 10 months ago.
This is what I tried, but not updating the categorydescription field/*---------UPDATE THERMAL PRINTER CATEGORY DESCRIPTIONS-----------*/
UPDATE [Volusion_WCL_Categories]
SET [CategoryDescription] = 'WideLongColorPerfOutside DiameterLabels Per RollRolls Per CartonPart
NumberShippingPriceOrdering'
FROM
[DistributorFeeds].[dbo].[Volusion_WCL_Categories] [Volusion_WCL_Categories]
INNER JOIN [DistributorFeeds].[dbo].[Volusion_WCL_Products]
[Volusion_WCL_Products]
ON CAST([Volusion_WCL_Categories].[categoryid] AS NVARCHAR) =
CASE WHEN CHARINDEX(',',[Volusion_WCL_Products].[categoryids]) 0
THEN LEFT ([Volusion_WCL_Products].[categoryids], CHARINDEX(',',[Volusion_WCL_Products].[categoryids])-1)
ELSE [Volusion_WCL_Products].[categoryids]
END
INNER JOIN [DistributorFeeds].[dbo].
[Volusion_Product_Attributes] [Volusion_Product_Attributes]
ON [Volusion_WCL_Products].[productcode] =
[Volusion_Product_Attributes].[productcode]WHERE
([Volusion_WCL_Categories].[categoryid] = 136) OR
([Volusion_WCL_Categories].[categoryid] = 135);/* LOOP THROUGH ALL PRODUCT CODES*/
DECLARE @productcode5 varchar(150)
DECLARE c1 CURSOR FOR
SELECT Volusion_WCL_Products.productcode
FROM Volusion_WCL_Products INNER JOIN
[913392] ON
Volusion_WCL_Products.productcode = [913392].[Vendor_part_Num]
ORDER BY
[913392].[Vendor_part_Num] ASCOPEN c1
FETCH NEXT FROM c1 INTO @productcode5
WHILE @@FETCH_STATUS = 0
BEGIN
-- PRINT 'Processing product code ' + @productcode/*--------------YOUR UPDATE ---------------*/UPDATE [Volusion_WCL_Categories]
SET [CategoryDescription] = convert(nvarchar(max),[CategoryDescription]) +''+ [Volusion_Product_Attributes].[PTR_Thermal_DTTT] + '"' + [Volusion_Product_Attributes].[PTR_Thermal_Print_Width]
+ ''' ' + [Volusion_Product_Attributes].[PTR_Thermal_DPI] + '' + [Volusion_Product_Attributes].[PTR_Thermal_Connections] + '' + [Volusion_Product_Attributes].[PTR_Thermal_Options] + '"' + [Volusion_Product_Attributes].[PTR_Thermal_Options] + '' + [Volusion_Product_Attributes].[PTR_Thermal_Options] + ''+
'' + [Volusion_WCL_Products].[productcode] + '
Same Day Shipping On Orders Before 2:00pm CST $' + CAST([Volusion_WCL_Products] .[productprice] AS VARCHAR) +
'
Per CartonAdd To Cart'
FROM
[DistributorFeeds].[dbo].[Volusion_WCL_Categories] [Volusion_WCL_Categories]
LEFT OUTER JOIN [DistributorFeeds].[dbo].[Volusion_WCL_Products]
[Volusion_WCL_Products]
ON CAST([Volusion_WCL_Categories].[categoryid] AS NVARCHAR) =
-- This case statement CASE..END extracts [categoryids] up to/exluding a comma, if there is one
CASE WHEN CHARINDEX(',',[Volusion_WCL_Products].[categoryids]) 0
THEN LEFT ([Volusion_WCL_Products].[categoryids], CHARINDEX(',',[Volusion_WCL_Products].[categoryids])-1)
ELSE [Volusion_WCL_Products].[categoryids]
END
INNER JOIN [DistributorFeeds].[dbo].
[Volusion_Product_Attributes] [Volusion_Product_Attributes]
ON [Volusion_WCL_Products].[productcode] =
[Volusion_Product_Attributes].[productcode]
-- ONLY APPEND DATA IF @productcode2 in loop MATCHES
WHERE @productcode5 = [Volusion_WCL_Products].[productcode] AND
([Volusion_WCL_Categories].[categoryid] = 136) OR
([Volusion_WCL_Categories].[categoryid] = 135);FETCH NEXT FROM c1 INTO @productcode5
ENDDEALLOCATE c1
/* END LOOP */
Expert:  Ingo U replied 10 months ago.

Can you just describe what you want in English? I can't decipher that from your pasting of attempts that don't work...

Customer: replied 10 months ago.
I would like to do the same update as before with an additional table joined. [Volusion_WCL_Products].[productcode] =[Volusion_Product_Attributes].[productcode]
Customer: replied 10 months ago.
Need to get data from [Volusion_Product_Attributes].[PTR_Thermal_DPI] on line 41 - can you add the table [Volusion_Product_Attributes] to the routine?/*---------UPDATE BEFORE DNP PRIDUCTS-----------*/
UPDATE [Volusion_WCL_Categories]
SET [CategoryDescription] = 'Bull'
FROM
[DistributorFeeds].[dbo].[Volusion_WCL_Categories] [Volusion_WCL_Categories]
LEFT OUTER JOIN [DistributorFeeds].[dbo].[Volusion_WCL_Products]
[Volusion_WCL_Products]
ON CAST([Volusion_WCL_Categories].[categoryid] AS NVARCHAR) =
CASE WHEN CHARINDEX(',',[Volusion_WCL_Products].[categoryids]) 0
THEN LEFT ([Volusion_WCL_Products].[categoryids], CHARINDEX(',',[Volusion_WCL_Products].[categoryids])-1)
ELSE [Volusion_WCL_Products].[categoryids]
END
-- [Volusion_WCL_Products].[categoryids]
RIGHT OUTER JOIN [DistributorFeeds].[dbo].[913392]
[913392]
ON [913392].[Vendor_Part_Num] = [Volusion_WCL_Products].[productcode]
WHERE
([Volusion_WCL_Categories].[categoryid] = 136) OR
([Volusion_WCL_Categories].[categoryid] = 135);/* LOOP THROUGH ALL PRODUCT CODES*/
DECLARE @productcode varchar(150)
DECLARE c1 CURSOR FOR
SELECT Volusion_WCL_Products.productcode
FROM Volusion_WCL_Products INNER JOIN
[913392] ON
Volusion_WCL_Products.productcode = [913392].[Vendor_Part_Num]
ORDER BY [913392].[Vendor_Part_Num]OPEN c1
FETCH NEXT FROM c1 INTO @productcode
WHILE @@FETCH_STATUS = 0
BEGIN
-- PRINT 'Processing product code ' + @productcode/*--------------YOUR UPDATE ---------------*/
UPDATE [Volusion_WCL_Categories]
SET [CategoryDescription] = convert(nvarchar(max),[CategoryDescription]) +' Shit' + [Volusion_Product_Attributes].[PTR_Thermal_DPI]
FROM
[DistributorFeeds].[dbo].[Volusion_WCL_Categories] [Volusion_WCL_Categories]
LEFT OUTER JOIN [DistributorFeeds].[dbo].[Volusion_WCL_Products]
[Volusion_WCL_Products]
ON CAST([Volusion_WCL_Categories].[categoryid] AS NVARCHAR) =
-- This case statement CASE..END extracts [categoryids] up to/exluding a comma, if there is one
CASE WHEN CHARINDEX(',',[Volusion_WCL_Products].[categoryids]) 0
THEN LEFT ([Volusion_WCL_Products].[categoryids], CHARINDEX(',',[Volusion_WCL_Products].[categoryids])-1)
ELSE [Volusion_WCL_Products].[categoryids]
END
RIGHT OUTER JOIN [DistributorFeeds].[dbo].[913392]
[913392]
ON [913392].[Vendor_Part_Num] = [Volusion_WCL_Products].[productcode]
-- ONLY APPEND DATA IF @productcode in loop MATCHES
WHERE @productcode = [Volusion_WCL_Products].[productcode]FETCH NEXT FROM c1 INTO @productcode
ENDDEALLOCATE c1
/* END LOOP *//*---------UPDATE AFTER DNP PRIDUCTS-----------*/
UPDATE [Volusion_WCL_Categories]
SET [CategoryDescription] = convert(nvarchar(max),[CategoryDescription]) +''
FROM
[DistributorFeeds].[dbo].[Volusion_WCL_Categories] [Volusion_WCL_Categories]
LEFT OUTER JOIN [DistributorFeeds].[dbo].[Volusion_WCL_Products]
[Volusion_WCL_Products]
ON CAST([Volusion_WCL_Categories].[categoryid] AS NVARCHAR) =
CASE WHEN CHARINDEX(',',[Volusion_WCL_Products].[categoryids]) 0
THEN LEFT ([Volusion_WCL_Products].[categoryids], CHARINDEX(',',[Volusion_WCL_Products].[categoryids])-1)
ELSE [Volusion_WCL_Products].[categoryids]
END
-- [Volusion_WCL_Products].[categoryids]
RIGHT OUTER JOIN [DistributorFeeds].[dbo].[913392]
[913392]
ON [913392].[Vendor_Part_Num] = [Volusion_WCL_Products].
[productcode];
Customer: replied 10 months ago.
I figured it out, sorry about the miscommunication.
Expert:  Ingo U replied 10 months ago.

OK, no problem.

Related Programming Questions