MS SQL Server truncate table with foreign key references
DELETE FROM tblProducts
DBCC CHECKIDENT ('database.dbo.tblProducts',RESEED, 0)
MS SQL import excel into temp table
sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ad Hoc Distributed Queries', 1; GO
RECONFIGURE; GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'AllowInProcess', 0 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'DynamicParameters', 0 GO SELECT * INTO #tempProduct FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\import.xls', 'SELECT * FROM [Sheet$]')
No comments:
Post a Comment