TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ankur Jain
NA
816
184.5k
Error in Query?
Sep 15 2014 2:13 AM
USE [SiteDemo]
GO
/****** Object: StoredProcedure [dbo].[sp_Master_SubCategoryInfo_SelectALLByCategoryName] Script Date: 09/15/2014 09:24:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
alter proc [dbo].[sp_Master_ProductInfoFilter]
@PageIndex INT = 1
,@PageSize INT = 10
,@SubCategoryName nvarchar(max)=null
,@RecordCount INT OUTPUT
AS
BEGIN
declare @Query nvarchar(MAX)
SET NOCOUNT ON;
set @Query= 'SELECT'+ ROW_NUMBER()OVER +'
(
ORDER BY [ID]desc
) AS'+ RowNumber +'
,[ID]
,[StoreName]
,[ProductName]
,[ProductBrand]
,[OldPrice]
,[NewPrice]
,[Discount]
,[ProductDiscription]
,[ProductRatings]
,[ProductFeatures]
,[ProductSiteLink]
,[ProductCategory]
,[ProductSubCategory]
,[Link]
,[ProductBannerImage]
,[ProductHoverImage]
,[ProductVideoLink]
,[ProductOverView]
,[ProductAdditionalInfo]
,[ProductIsActive]
,[ProductIsFeatured]
,[ProductIsNewArrival]
,[ProductIsBestSeller]
,[ProductInStock]
,[IsLatest]
,[AvailableSizes]
,[AvailableColors]
,[CouponCode]
,[CreatedBy]
,[CreatedOn]
,[ModifiedBy]
,[ModifiedOn] INTO #Results FROM [Master_ProductInfo] '+ @SubCategoryName + ' '+ 'SELECT @RecordCount = COUNT(*) FROM #Results
SELECT * FROM #Results
WHERE RowNumber BETWEEN '+ (@PageIndex -1) * @PageSize + 1 +' AND'+ (((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1 +'
DROP TABLE #Results'
END
Reply
Answers (
2
)
Stored Procedure
How to copy table data from one database to another darabase