hadi000333
چهارشنبه 25 آذر 1388, 13:31 عصر
با سلام خدمت همه دوستان و اساتيد محترم
من يه كوئري نوشتم كه در sql 2008 به خوبي و هيچ مشكلي كار ميكنه و لي در sql 2005 كه در سرور هست اين خطا رو مي ده
Msg 1046, Level 15, State 1, Procedure SP_Commerce_GetCustomerReport, Line 18
Subqueries are not allowed in this context. Only scalar expressions are allowed.
Msg 102, Level 15, State 1, Procedure SP_Commerce_GetCustomerReport, Line 20
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Procedure SP_Commerce_GetCustomerReport, Line 21
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Procedure SP_Commerce_GetCustomerReport, Line 23
Incorrect syntax near ')'.
اسكريپت منم
/****** Object: StoredProcedure [dbo].[SP_Commerce_GetCustomerReport] Script Date: 12/16/2009 02:02:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_Commerce_GetCustomerReport]
AS
/* SET NOCOUNT ON */
DECLARE @CustomerTotals TABLE
(
NewCustomersCount int ,
TotalCustomerCount int ,
OnLineCustomersCount int ,
ALLOfCustomerTodayLogin int
)
INSERT INTO @CustomerTotals (NewCustomersCount,TotalCustomerCount,OnLineCustom ersCount,ALLOfCustomerTodayLogin)
VALUES(
(SELECT COUNT(*) FROM Commerce_Customer
Where DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0)= DATEADD(dd, DATEDIFF(dd,0,Commerce_Customer.JoinDate), 0) ),
(SELECT COUNT(*) FROM Commerce_Customer ),
(SELECT COUNT(*) FROM Commerce_Customer WHERE DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0) =DATEADD(dd, DATEDIFF(dd,0,Commerce_Customer.LastActivityDate), 0) ),
(SELECT COUNT(*) FROM Commerce_Customer WHERE DATEADD(dd, DATEDIFF(dd,0,Commerce_Customer.LastLoginDate), 0) = DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0))
)
Select * from @CustomerTotals
RETURN
GO
با تشكر
من يه كوئري نوشتم كه در sql 2008 به خوبي و هيچ مشكلي كار ميكنه و لي در sql 2005 كه در سرور هست اين خطا رو مي ده
Msg 1046, Level 15, State 1, Procedure SP_Commerce_GetCustomerReport, Line 18
Subqueries are not allowed in this context. Only scalar expressions are allowed.
Msg 102, Level 15, State 1, Procedure SP_Commerce_GetCustomerReport, Line 20
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Procedure SP_Commerce_GetCustomerReport, Line 21
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Procedure SP_Commerce_GetCustomerReport, Line 23
Incorrect syntax near ')'.
اسكريپت منم
/****** Object: StoredProcedure [dbo].[SP_Commerce_GetCustomerReport] Script Date: 12/16/2009 02:02:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_Commerce_GetCustomerReport]
AS
/* SET NOCOUNT ON */
DECLARE @CustomerTotals TABLE
(
NewCustomersCount int ,
TotalCustomerCount int ,
OnLineCustomersCount int ,
ALLOfCustomerTodayLogin int
)
INSERT INTO @CustomerTotals (NewCustomersCount,TotalCustomerCount,OnLineCustom ersCount,ALLOfCustomerTodayLogin)
VALUES(
(SELECT COUNT(*) FROM Commerce_Customer
Where DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0)= DATEADD(dd, DATEDIFF(dd,0,Commerce_Customer.JoinDate), 0) ),
(SELECT COUNT(*) FROM Commerce_Customer ),
(SELECT COUNT(*) FROM Commerce_Customer WHERE DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0) =DATEADD(dd, DATEDIFF(dd,0,Commerce_Customer.LastActivityDate), 0) ),
(SELECT COUNT(*) FROM Commerce_Customer WHERE DATEADD(dd, DATEDIFF(dd,0,Commerce_Customer.LastLoginDate), 0) = DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0))
)
Select * from @CustomerTotals
RETURN
GO
با تشكر