Bulk update to True in dbo.table [Published] in database

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 Jahre weitere
I'm trying to turn OFF "published" a product.
Instead of doing it one by one in nop admin panel.
I want to do it via database.
May I ask how to perform it?
http://sendfile.cc/uploads/file/201809/0.910576001536885778.png

USE [MyOwnDatabase]
GO

UPDATE [dbo].[Product]
Set [Published]
5 Jahre weitere
popolun wrote:
I'm trying to turn OFF "published" a product.
Instead of doing it one by one in nop admin panel.
I want to do it via database.
May I ask how to perform it?
http://sendfile.cc/uploads/file/201809/0.910576001536885778.png

USE [MyOwnDatabase]
GO

UPDATE [dbo].[Product]
Set [Published]


Hi.
You can try this ...
SELECT [Id]      
      ,[Published]
  FROM [MyOwnDatabase].[dbo].[Product]
  update [MyOwnDatabase].[dbo].[Product] set [Published] = false

Best Regards.
5 Jahre weitere
UPDATE [dbo].[Product]
Set [Published] = 0
5 Jahre weitere
New York wrote:
UPDATE [dbo].[Product]
Set [Published] = 0


It works! Thank You
1 Jahr weitere
Hi,

I try to assign 2000 existing products to a new category through sql command.
When I run
Update [dbo].[Product_Category_Mapping]
set [CategoryId] = '30'
where ProductId between '1' and '2000'

it overwrites the existing CategoryId on the products. Right now, all products are under the new category, but other categories have no products.

How can I keep the products in the current categories while the products can also exist in the new category?

Thanks
1 Jahr weitere
popolun wrote:

How can I keep the products in the current categories while the products can also exist in the new category?

you can execute this query
INSERT INTO [Product_Category_Mapping] ([CategoryId]
      ,[ProductId]
      ,[IsFeaturedProduct]
      ,[DisplayOrder])
SELECT distinct {YourNewCategoryId}, pcm.ProductId, 'false', 0
FROM [Product_Category_Mapping] AS pcm
where pcm.ProductId between 1  and 2000
1 Jahr weitere
Thank you
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.