简体   繁体   中英

Create Index equivalent from Oracle to SQL Server

I have a current index that I have pulled from Oracle and I am trying to add to SQL Server. As far as I can tell, I will have to remove the double quotes and use WITH(... However, I cannot find the Maxtrans and other keywords equivalent in SQL Server, especially the M_ROW$$ , which I was thinking it would be the ROW_NUMBER .

CREATE UNIQUE INDEX ""MYDB"".""I_SNAP$MYTABLE"" ON 
""MYDB"".""MYTABLE"" (""M_ROW$$"")          
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS             
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645           
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)            
TABLESPACE ""IL_MIS_INDX""          

Any help will be greatly appreciated.

Thank you!

I'm guessing you don't need all the options. So, just use the default syntax:

CREATE UNIQUE INDEX <MYDB.I_SNAP$MYTABLE> ON MYDB.MYTABLE (<M_ROW$$>)     

Of course, the table name and column name needs to be the actual names in SQL Server.

I am speculating that you don't need the index options in SQL Server. If you do, you will need to optimize the index for that database, rather than assuming that what works in Oracle will automatically work in SQL Server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM