200分!!!求SQL语句求高手
declare @isEmpty int;
set @isEmpty=0;
Select top 10 *
from Gy_StyleClassLang with (nolock)
where
(case
when @isEmpty=1 then (title is not null and title <>'')
when @isEmpty=2 then (title is null or title ='')
else 1=1
end)
我的意图如上,当参数值不同时列的条件也不同,希望大牛帮助一下,能不用if else尽量不要用
set @isEmpty=0;
Select top 10 *
from Gy_StyleClassLang with (nolock)
where
(case
when @isEmpty=1 then (title is not null and title <>'')
when @isEmpty=2 then (title is null or title ='')
else 1=1
end)
我的意图如上,当参数值不同时列的条件也不同,希望大牛帮助一下,能不用if else尽量不要用
...全文
相关推荐
sql语句、动态SQL语句基本语法
例如,在PL/SQL(Oracle)中,可以写成: ```sql DECLARE sql_query VARCHAR2(200); BEGIN sql_query := 'SELECT * FROM table_name
SQL Server只能编辑前200行问题
使用SQL语句最直接的方法是通过编写SQL查询语句来处理数据,而不是依赖于SSMS的数据网格。
SQLServer动态SQL语句的用法
语句中,可以使用多个参数,例如:declare @QueryString nvarchar(1000)declare @paramstring nvarchar(200)declare @input_id
SQL语句教程--教你写好SQL语句
### SQL语句教程知识点详解#### 一、SELECT语句**定义与作用:**- `SELECT` 是SQL中最常用的语句之一,主要用于从数据库表中检索数据。
SQL语句实现查询SQL Server服务器名称和IP地址
在SQL Server中,有时我们需要获取服务器的名称和IP地址,这在系统管理和远程连接时尤其重要。本篇文章将详细介绍如何使用SQL语句来查询这些信息。


