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 years ago
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 years ago
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 years ago
UPDATE [dbo].[Product]
Set [Published] = 0
5 years ago
New York wrote:
UPDATE [dbo].[Product]
Set [Published] = 0


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