hgh.just.hony
یک شنبه 19 آذر 1391, 08:25 صبح
من تو برنامم موتور سرچ دارم که کاربر براساس هرکدام که پر کرد سرچ کنه :
در عکس ضمیمه هستش
سوالم اینه من این کد را تو SQL نوشتم اما کار نمی کنه
USE [Marketing]
GO
/****** Object: StoredProcedure [dbo].[usp_Advance_search] Script Date: 12/09/2012 08:43:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_Advance_search]
-- Add the parameters for the stored procedure here
@type nvarchar(50)= null ,
@exact_word_name nvarchar(300)= null,
@like_word_name_detail nvarchar(300)= null,
@Down_price money= 0 ,
@top_price money=null,
@Detail nvarchar(max)= null,
@City_provinc nvarchar(60)= null,
@type_cmp_prd nvarchar(500)= null
AS
BEGIN
SET NOCOUNT ON;
SELECT distinct dbo._Product.Prd_Name,
dbo._Product.Prd_Id ,dbo._Product.PrdTyp_CountUnit,
dbo.[_Company&Users].Cmp_Id ,dbo.format(dbo._Product.Prd_Price ,'#,###') as Prd_Price,
dbo.[_Company&Users].Usr_Id,dbo._ProductType.PrdTyp_Title,
'~/'+ dbo._Product.Prd_Image as Prd_Image,
--dbo.ReplaceCRWithBR(dbo._Product.Prd_Comment) as prd,
substring(dbo._Product.Prd_Comment,1,200) as prd,
dbo._Company.Cmp_Name,
dbo._Company.Cmp_webSite,
dbo._Company.Cmp_Email, dbo._CompanyType.CmTy_Title,dbo._TypeRegisterCompa ny.TypReg_Tittle,
dbo._Users.Usr_UserName,dbo._Users.Usr_Email ,dbo._City.Cty_Name,
dbo._Province.Prv_Name,dbo.ReplaceCRWithBR(dbo._Co mpany.Cmp_Detail) as cmp
FROM dbo._Product INNER JOIN
dbo.[_Product&ProductType] ON dbo._Product.Prd_Id = dbo.[_Product&ProductType].Prd_Id INNER JOIN
dbo._ProductType ON dbo.[_Product&ProductType].PrdTyp_Id = dbo._ProductType.PrdTyp_Id INNER JOIN
dbo._Company ON dbo._Product.Cmp_Id = dbo._Company.Cmp_Id INNER JOIN
dbo._CompanyType ON dbo._Company.CmTy_Id = dbo._CompanyType.CmTy_Id INNER JOIN
dbo.[_Company&Users] ON dbo._Company.Cmp_Id = dbo.[_Company&Users].Cmp_Id INNER JOIN
dbo._TypeRegisterCompany ON dbo._Company.TypReg_Id = dbo._TypeRegisterCompany.TypReg_Id INNER JOIN
dbo._Users ON dbo.[_Company&Users].Usr_Id = dbo._Users.Usr_Id INNER JOIN
dbo._City ON dbo._Company.City_Id = dbo._City.Cty_Id INNER JOIN
dbo._Province ON dbo._City.Prv_Id = dbo._Province.Prv_Id, (select * From dbo.split(N''+@Detail,' ')) as T1
where dbo._Product.Ped_IsDeleted = 0 and dbo._Company.Cmp_IsDeleted=0
and dbo.[_Company&Users].CmpUsr_IsActive=1
and dbo._Users.Usr_IsDeleted=0 and
(dbo._Product.Prd_Name like (N'%'+@exact_word_name+'%')) AND
(dbo._Product.Prd_Name like (N'%'+@like_word_name_detail+'%')) AND
(dbo._Product.Prd_Comment like (N'%'+@like_word_name_detail+'%')) AND
(dbo._Product.Prd_Price >= @Down_price) AND
(dbo._Product.Prd_Price <= @top_price) and
(dbo._Product.Prd_Comment like (N'%'+T1.Items+'%')) and
(dbo._Company.Cmp_Detail like (N'%'+T1.Items+'%')) and
(dbo._Company.Cmp_Name like (N'%'+T1.Items+'%')) and
(dbo._Company.Cmp_webSite like (N'%'+T1.Items+'%')) and
(dbo._Company.Cmp_Address like (N'%'+T1.Items+'%')) and
(dbo._ProductType.PrdTyp_Title like (N'%'+T1.Items+'%')) and
(dbo._CompanyType.CmTy_Title like (N'%'+T1.Items+'%'))and
(dbo._City.Cty_Name like (N'%'+@City_provinc+'%') )
and
(dbo._Province.Prv_Name like ('%'+@City_provinc+'%'))
END
هدف اصلیم ساخت موتور جستجو هست(میشه راهنماییم کنین که چه جور میشه موتور جستجو قوی ساخت که تو دیتابیسم خوب بتونه سرچ کنه)
در عکس ضمیمه هستش
سوالم اینه من این کد را تو SQL نوشتم اما کار نمی کنه
USE [Marketing]
GO
/****** Object: StoredProcedure [dbo].[usp_Advance_search] Script Date: 12/09/2012 08:43:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_Advance_search]
-- Add the parameters for the stored procedure here
@type nvarchar(50)= null ,
@exact_word_name nvarchar(300)= null,
@like_word_name_detail nvarchar(300)= null,
@Down_price money= 0 ,
@top_price money=null,
@Detail nvarchar(max)= null,
@City_provinc nvarchar(60)= null,
@type_cmp_prd nvarchar(500)= null
AS
BEGIN
SET NOCOUNT ON;
SELECT distinct dbo._Product.Prd_Name,
dbo._Product.Prd_Id ,dbo._Product.PrdTyp_CountUnit,
dbo.[_Company&Users].Cmp_Id ,dbo.format(dbo._Product.Prd_Price ,'#,###') as Prd_Price,
dbo.[_Company&Users].Usr_Id,dbo._ProductType.PrdTyp_Title,
'~/'+ dbo._Product.Prd_Image as Prd_Image,
--dbo.ReplaceCRWithBR(dbo._Product.Prd_Comment) as prd,
substring(dbo._Product.Prd_Comment,1,200) as prd,
dbo._Company.Cmp_Name,
dbo._Company.Cmp_webSite,
dbo._Company.Cmp_Email, dbo._CompanyType.CmTy_Title,dbo._TypeRegisterCompa ny.TypReg_Tittle,
dbo._Users.Usr_UserName,dbo._Users.Usr_Email ,dbo._City.Cty_Name,
dbo._Province.Prv_Name,dbo.ReplaceCRWithBR(dbo._Co mpany.Cmp_Detail) as cmp
FROM dbo._Product INNER JOIN
dbo.[_Product&ProductType] ON dbo._Product.Prd_Id = dbo.[_Product&ProductType].Prd_Id INNER JOIN
dbo._ProductType ON dbo.[_Product&ProductType].PrdTyp_Id = dbo._ProductType.PrdTyp_Id INNER JOIN
dbo._Company ON dbo._Product.Cmp_Id = dbo._Company.Cmp_Id INNER JOIN
dbo._CompanyType ON dbo._Company.CmTy_Id = dbo._CompanyType.CmTy_Id INNER JOIN
dbo.[_Company&Users] ON dbo._Company.Cmp_Id = dbo.[_Company&Users].Cmp_Id INNER JOIN
dbo._TypeRegisterCompany ON dbo._Company.TypReg_Id = dbo._TypeRegisterCompany.TypReg_Id INNER JOIN
dbo._Users ON dbo.[_Company&Users].Usr_Id = dbo._Users.Usr_Id INNER JOIN
dbo._City ON dbo._Company.City_Id = dbo._City.Cty_Id INNER JOIN
dbo._Province ON dbo._City.Prv_Id = dbo._Province.Prv_Id, (select * From dbo.split(N''+@Detail,' ')) as T1
where dbo._Product.Ped_IsDeleted = 0 and dbo._Company.Cmp_IsDeleted=0
and dbo.[_Company&Users].CmpUsr_IsActive=1
and dbo._Users.Usr_IsDeleted=0 and
(dbo._Product.Prd_Name like (N'%'+@exact_word_name+'%')) AND
(dbo._Product.Prd_Name like (N'%'+@like_word_name_detail+'%')) AND
(dbo._Product.Prd_Comment like (N'%'+@like_word_name_detail+'%')) AND
(dbo._Product.Prd_Price >= @Down_price) AND
(dbo._Product.Prd_Price <= @top_price) and
(dbo._Product.Prd_Comment like (N'%'+T1.Items+'%')) and
(dbo._Company.Cmp_Detail like (N'%'+T1.Items+'%')) and
(dbo._Company.Cmp_Name like (N'%'+T1.Items+'%')) and
(dbo._Company.Cmp_webSite like (N'%'+T1.Items+'%')) and
(dbo._Company.Cmp_Address like (N'%'+T1.Items+'%')) and
(dbo._ProductType.PrdTyp_Title like (N'%'+T1.Items+'%')) and
(dbo._CompanyType.CmTy_Title like (N'%'+T1.Items+'%'))and
(dbo._City.Cty_Name like (N'%'+@City_provinc+'%') )
and
(dbo._Province.Prv_Name like ('%'+@City_provinc+'%'))
END
هدف اصلیم ساخت موتور جستجو هست(میشه راهنماییم کنین که چه جور میشه موتور جستجو قوی ساخت که تو دیتابیسم خوب بتونه سرچ کنه)