![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
sql server数据库
ラピスラズリ(Dawn)
No pains,no gains!
展开
-
Sql练习201908210951
表结构:create table SalePlan ( PlanId int identity(1,1) primary key, GoodsId int, PlanPrice decimal(18,2));gocreate table Goods ( GoodsId int identity(1,1) primary key, Price...原创 2019-08-21 11:32:01 · 77 阅读 · 0 评论 -
Sql练习201908200916
表结构:一条sql修改多条数据(Sql server),oracle,mysql请自行尝试:update orders_jimmy set country_nid = (case country_nid when 0 then 0 else country_nid end) where 1 = 1;go完成....原创 2019-08-20 09:18:00 · 56 阅读 · 0 评论 -
Sql练习201908131742
orderdt_jimmy表结构:sql查询:select sum(case when nid >= 1 and nid <= 1000 then amount end) t1,sum(case when nid >= 1001 and nid <= 5000 then amount end) t2,sum(case when nid >= 5001...原创 2019-08-13 17:46:00 · 54 阅读 · 0 评论 -
SQL Server将列以分隔符分割后存到临时表
begin if object_id('tempdb..#t') is not null drop table #t; create table #t ( filepath nvarchar(300) ); declare @filePathStr nvarchar(max), @endIndex int = 1, ...原创 2019-06-25 15:26:00 · 129 阅读 · 0 评论 -
Java调用存储过程出现Bug,sql语法错误
因为SQL Server运行没有正常,检查了传入参数的值,发现问题,然后传入默认参数,解决了问题.原创 2019-06-18 09:33:00 · 163 阅读 · 0 评论 -
Java的jdbc调用SQL Server存储过程Bug201906131120
如果要查询结果,存储过程的第一行使用set nocount on;可能可以解决问题.原创 2019-06-13 11:21:00 · 108 阅读 · 0 评论 -
SQL分组聚合查询练习(SQL Server和Oracle相似)20190514
先建表CREATE TABLE [dbo].[orderdt_jimmy]( [nid] [int] PRIMARY KEY IDENTITY(1,1) NOT NULL, [order_nid] [int] NOT NULL, [sku] [varchar](100) NOT NULL, [qty] [int] NOT NULL, [price] [...原创 2019-05-14 15:40:00 · 100 阅读 · 0 评论 -
SQL使用exists时的多种写法
select 1 from test;goselect top 1 1 from test;go下面这种效率明显高不少.原创 2019-04-16 11:39:00 · 84 阅读 · 0 评论 -
SQL Server数据库的除法默认向下取整,要返回小数的解决方法
select 1 / 1000 num1;select 1 / 1000.0 num2;select 1 / 1000 * 1.0 num3;select 1.0 * 1 / 1000 num4;结果:原创 2019-03-29 09:29:00 · 1209 阅读 · 0 评论 -
Sql Server cross apply和outer apply
with result as(select t.str from(select '1' strunion allselect '2' strunion allselect '3' strunion allselect '4' strunion allselect '5' strunion allselect '6' strunion allselect '7' str...原创 2019-03-18 10:34:00 · 100 阅读 · 0 评论 -
sql server update+select(子查询修改)20190304
if OBJECT_ID('tempdb..##t2') is not null drop table ##t2;create table ##t2(a int,b int,c datetime,d varchar(100),e varchar(100),f int,g int);select * from ##t2;update ##t2set f = t3.f,g...原创 2019-03-04 09:59:00 · 1099 阅读 · 0 评论 -
SqlServer数据库练习20190211
一条update语句,修改多个条件update orderdt_jimmy set qty = (case when qty = 941 then 41when qty = 942 then 42else qtyend);好了,就这样原创 2019-02-11 17:47:00 · 226 阅读 · 0 评论 -
SQL Server错误: 0 解决方案
1.已设置两种登录模式.2.SQL Server配置管理器已配置好.按Windows徽标键+R组合键,然后输入cmd.再然后输入netsh winsock reset.接下来重启电脑,应该就可以连接了.如果以上两种未设置好,请先设置好....原创 2017-05-08 09:50:00 · 651 阅读 · 0 评论 -
Sql练习201908200918
表结构:昨天遇到一个笔试题,求一个聚合函数小于等于1000的值,并将编号同时输出.sql server:select nid,SUM(amount) amountSum from orders_jimmygroup by nidhaving SUM(amount) <= 1000;gooracle:select nid,SUM(amount) from or...原创 2019-08-20 09:24:00 · 60 阅读 · 0 评论