MySQL中用sql语句插入时期
mysql> create table testdate(
-> id int not null auto_increment primary key,
-> time date);
Query OK, 0 rows affected (0.30 sec)
mysql> insert into testdate(time) values('2010-4-23');
Query OK, 1 row affected (0.06 sec)
mysql> select * from testdate;
+----+------------+
| id | time |
+----+------------+
| 1 | 2010-4-23|
+----+------------+
1 row in set (0.00 sec)
mysql> alter table testdate add column current time;
Query OK, 1 row affected (0.25 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> update testdate set current='21:18:00' where id=1;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from testdate;
+----+------------+----------+
| id | time | current |
+----+------------+----------+
| 1 | 2010-4-23 | 21:18:00 |
+----+------------+----------+
1 row in set (0.00 sec)
mysql> alter table testdate add column combine timestamp;
Query OK, 1 row affected (0.14 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> update testdate set combine='20050504212000' where id=1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> select * from testdate;
+----+------------+----------+---------------------+
| id | time | current | combine |
+----+-------
相关文档:
set @sql = 'select * from OPENROWSET(''SQLOLEDB'',''SERVER='+@serverip+';uid=sa;pwd=sa;Database='+@databaseName+''',''SET FMTONLY OFF;set nocount on exec procName '''''+@yqid+''''''' ) as   ......
--------------------------------------------------------------------------
-- Author : htl258(Tony)
-- Date : 2010-04-23 20:33:15
-- Version:Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
-- Jul  ......
由于前段时间要用powerdesigner设计数据库,可数据库设计好后好导入MysQL时需要ODBC连接,而MysQL5.0以上的均要修改密码(我在网上查过),按他们的意思修改了root密码,结果是直接进不了MysQL了,我那个郁闷,在网上查找资料,也按他们的方法做了,可还是不行(本人对dos不熟)。但最终还是可以了,下面说下具体方法
1、w ......
如果SQL Server程序员想将表达式从一种换为另一种,他可以从SQL Server 7和2000中自带的两种功能中做出选择。在存储过程或其他情况下,我们常常需要将数据从datetime型转化成varchar型;CONVERT和CAST就可以用于这种情况。
由于SQL Server提供两种功能,因此应该选择哪种功能或应该在哪种情况下使用该功能就很容易让 ......
Sql Server 中一个非常强大的日期格式化函数
--
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(10 ......