To add a field to a specific table in a particular database:
to add a field to a specific table in a particular database:ALTER TABLE Test1.dbo.test1 Add "name9" int must be careful to add type
2 adding data from one table to another table update test.dbo.test//Database Set test.sex = xx.sex//write field value from (select Id,sex from test1.db O.TEST1) as XX//Added condition where xx.id=test.id//3 runs SQL statement 1 on the command line. Sqlcmd-e-dmaster–i followed by file address pause 2. Create a. bat file under C to write a statement. Click to run the SQL program. 3 Create a table: Use Ftest3create table Sysnavy (navy_id varchar (a) NOT NULL primary key,navy_name varchar (), Navy_lev varchar (a), navy_parent_id varchar (+), Create_name varchar (+), Create_time varchar (+), Update_name varchar (+), Update_ Time varchar, Navy_url varchar (+), Navy_sort int) 4 Add the data from the original table to the newly created table: INSERT INTO Ftest3.dbo.test (Navy_id,navy_name, Navy_parent_id,create_man,create_time,navy_sort,navy_url,navy_lev,update_man,update_time) Select Navy_id,A.navy_ Name,navy_parent_id,create_man,create_time,navy_sort,navy_url,navy_lev,update_man,update_time from Test2.dbo.testas awhere nnavy_id!= (select navy_id from ftest3.dbo.test)//Here is how the conditional statement is implemented this is the table data that has the same table name in different data
Scripting for several SQL languages