复制代码 代码如下: declare @bl decimal(10,6),@num int,@num1 int ,@str char(20),@str1 char(20),@str2 char(20),@str3 char(20),@zx int,@zx1 int set @bl=1110.10000 set @str1=ltrim(REVERSE(cast(@bl as char(30))))
一.建立数据库Liezui_Test ID int 主键 自增 Title varchar(100) ReadNum int 二.向数据库中插入100万条数据 declare @i int set @i=1 while @i=500000 begin insert into Liezui_Test(Title,ReadNum) values('执行总数统计',@i) 一.建立数据库Liezui_T
declare @i int set @i='a' set @i=cast('a' as int) set @i=convert(int, 'a') print @i --输出结果为:将 varchar 值 'a' 转换为数据类型为 int 的列时发生语法错误。这一点与java不一样 declare @ch varchar(90) set @ch declare @i int set @
复制代码 代码如下: --create database dbTemp use dbTemp create table test ( Pid int identity(1,1) not null primary key, Years datetime, IsFirstSixMonths int default(0), --0表示上半年1表示下半年-- TotalCome int ) insert
目录 左外连接 内连接INNER JOIN 我们准备如下两个表,并插入数据。 #分类CREATE TABLE IF NOT EXISTS `type` (`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,`card` INT(10) UNSIGNED NOT NULL,PRIMARY KEY (`id`));#图书CRE 目录左外连接内连接INNER JO
目录 前言 方法一 replace into 方法二 on duplicate key 总结 前言 假设有一张demo表,主键为id,唯一索引是code create table demo(id int auto_increment,name int null,gender int null,age int null,code int null,constr 目录前言方法一 replace int
NULL 值代表遗漏的未知数据。 默认地,表的列可以存放 NULL 值。 本章讲解 IS NULL 和 IS NOT NULL 操作符。 语法 当创建表时,NULL 的基本语法如下: CREATE TABLE COMPANY( ID INT PRIMARY KEY NOT NULL, NULL 值代表遗漏的未知数据。 默认地,表的列可以存放 NULL 值。 本章讲解 IS NULL 和 IS NO