In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to achieve string non-empty judgment in sql server, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
The code is as follows: CREATE function getcolor (@ well sign varchar (50), @ horizon varchar (50)) returns varchar (200) as begin declare @ sql varchar (2000); set @ sql=''-- distinct select @ sql=@sql+ color +', 'from (select distinct color from yourtablename where sign = @ well sign and horizon = @ horizon and color is not null) aa set @ sql=substring (@ sql,1,len (@ sql)-1) return @ sql end
I found that the sentence set @ sql=substring (@ sql,1,len (@ sql)-1) sometimes reports an error because @ sql sometimes has an empty string when using substring. How can I tell whether @ sql is empty before substring in the function? If @ sql is not null and len (@ sql) > = 1 set @ sql=substring (@ sql,1,len (@ sql)-1) else... The copy code is as follows: if (@ sql is not null) set @ sql=substring (@ sql,1,len (@ sql)-1) return @ sql copy code as follows: if isnull (@ sql,'')''set @ sql=substring (@ sql,1,len (@ sql)-1)
"select * from db where img is not null" this is to select all the content whose img is not empty "select * from db where img isnull" this is to select all the content whose img is empty. If you want to make the SQL judgment value null, you can use SELECT top 1 isnull (Yu_Yse_Commodity_KD,0) FROM [Yu_Records].
After reading the above, do you have any further understanding of how to realize the string non-null judgment in sql server? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
xml version= "1.0" encoding= "utf-8"? >
© 2024 shulou.com SLNews company. All rights reserved.