SQL 2个查询问题

来源:百度知道 编辑:UC知道 时间:2024/07/08 10:25:39
我在做一个小的汽车查询项目.
2个问题,希望指教.

1.如何实现 用拼音检索汉字啊?
2.表里有两个字段,
火车站-五一路-新华路-汽车西站;五一路-新华路-汽车西站.
当用户输入: 火车站 和 汽车西站 时 ,如何查询到中转站?
谢谢!

这个我感觉不是这么设计的

id pre next place
1 0 2 火车站
2 1 3 五一路
3 2 4 新华路
4 3 0 汽车西站

1.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[f_GetPy]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[f_GetPy]
GO

--创建取拼音函数
create function f_GetPy(@Str nvarchar(400))
returns nvarchar(4000)
as
begin
declare @strlen int,@re nvarchar(4000)
declare @t table(chr nchar(1) collate Chinese_PRC_CI_AS,letter nchar(1))
insert @t select '吖','A' union all select '八','B'
union all select '嚓','C' union all select '咑','D'
union all select '妸','E' union all select '发','F'
union all select '旮','G' union all select '铪','H'
union all select &