SQL Server 2008中的新日期数据类型(2)
主要执行代码,比较乱,没有整理,不过实现功能就行了。
以下为引用的内容:
procedure TForm1.Button1Click(Sender: TObject);
var
i:Integer;
FieldN, tableN, fieldM,aa:String;
begin
if Not ADOConnOrcale.Connected then
begin
MsgBox('请先连接Oracle数据库!');
exit;
end;
if not ADOConnSQLServer.Connected then
begin
MsgBox('请先连接SQL Server数据库!');
exit;
end;
Screen.Cursor :=crHourGlass;
try
o1.Close;
O1.SQL.Clear;
//取oracle表用户budget的所有主键约束信息
o1.SQL.Text :=' select a.CONSTRAINT_NAME,a.CONSTRAINT_TYPE,a.TABLE_NAME, b.COLUMN_NAME,[NextPage]
b.position '+
' from USER_CONSTRAINTS a,USER_CONS_COLUMNS b where a.CONSTRAINT_NAME=b.CONSTRAINT_NAME '+
' and a.table_name=b.table_name and constraint_type=''P'' and a.owner=b.owner '+
' and lower(a.owner)=''budget'' order by a.table_name,b.position ';
O1.open;
tableN:='';
O1.First;
ProgressBar1.Max:=O1.RecordCount;
ProgressBar1.Min:=0;
ProgressBar1.Step:=1;
ProgressBar1.Visible :=true;
for i:=0 to O1.RecordCount -1 do
begin
s2.Close;
S2.SQL.Clear;
//判断SQL Server表是否存在当前的字段信息
S2.SQL.Text:='SELECT a.name AS tanme, b.* FROM sysobjects a INNER JOIN '+
' syscolumns b ON a.id = b.id '+
' WHERE (a.xtype = ''U'') AND (a.name = '''+O1.fieldbyname('table_name').AsString+''''+
') and b.name= '''+O1.fieldbyname('COLUMN_NAME').AsString+''''+
' ORDER BY b.id';
S2.Open;
相关新闻>>
- 发表评论
-
- 最新评论 进入详细评论页>>