TSQL中的基本任务TSQL Backspace中的char [英] Basic task in TSQL Backspace char in Tsql

查看:75
本文介绍了TSQL中的基本任务TSQL Backspace中的char的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有sql"

Hi Guys,
I have sql "

SELECT loc.street_1 + ', ' + ISNULL(loc.street_2, ' ') AS street

"

现在,我只想在第二个街道名称为Null时擦除第一个街道名称之后的,".我试过像ISNULL(loc.street_2,``\ b'')一样,但是它不起作用..甚至用08(ASCII码)替换了\ b仍然没有得到我想要的东西..可以有任何东西吗?想法怎么做..

非常感谢...

"

Now I just want to wipe of "," after first street name when second street name is Null. I tried like ISNULL(loc.street_2, ''\b'') but it''s not working.. even replaced \b with 08(ASCII code) still didn''t got what I want.. can one have any idea how to do that..

Thanks a lot...

推荐答案

在SQL中没有像这样的退格键,您需要使用TSQL中的字符串函数来构建子字符串.你在追.我不认为使用退格键尝试删除字符甚至在C#中都行不通.只是个坏主意.
There''s no backspaces going to work like that in SQL, you need to use the string functions inside TSQL to build the substring you''re after. Using a backspace to try to delete a character wouldn''t even work in C#, I don''t think. It''s just a bad idea.


OK ..谢谢...我必须为此编写自己的字符串函数吗?还是有任何预定义的函数?
OK.. thanks for that...Do I have to write my own string function for it.. or any predefined functions are there??


不要按"answer"来提问. [
Don''t push ''answer'' to ask questions. This[^] is what you need.


这篇关于TSQL中的基本任务TSQL Backspace中的char的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆