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.
Il y a 5 ans
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]
Il y a 5 ans
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.
Il y a 5 ans
UPDATE [dbo].[Product]
Set [Published] = 0
Il y a 5 ans
New York wrote:
UPDATE [dbo].[Product]
Set [Published] = 0


It works! Thank You
Il y a 1 an
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
Il y a 1 an
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
Il y a 1 an
Thank you
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.