sqlite 中
CREATE TABLE table1 (
id integer primary key autoincrement,
name text default '',
[index] integer default ROWID
)
有没有类似的功能,让 index 的值默认等于id,比如
insert into table1 (id,name) values (null,'第一行');
insert into table1 (id,name) values (null,'第二行');
我希望结果是
id name index
1 第一行 1
2 第二行 2
能实现吗?
一定要用到触发器和存储过程吗?不能直接设置成默认值吗
呵呵,不能,测试了一下不行
嗯,知道了,果然是不行的
测试可以这样 :
insert into table1c values (null,'第一行',(select rowid from table1c));
相关问答:
C# code:
System.Data.SQLite.SQLiteConnection conn = new SQLiteConnection(@"acs.db");
try
{
conn.Open();
}
......
如下语句 :
select TimeSpan from T_Table where onlineDate = '2009-12-2'
数据库里面有符合条件的值但是查不出来
如果改成如下:
select TimeSpan from T_Table where onlineDate = '200 ......
程序代码如下:
sqlTime = "select SUM(onlineTimeSpan) from T_OnlineTimeSum where ipAddress = :a AND onlineDate BETWEEN :b AND :c";
  ......
string ConStr="data source=C:\ceshi.db;verson=3;password=123456";
SQLiteConnection MyConnection = new SQLiteConnection(ConStr);
try
{ ......
XML code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx ......