Search

Showing posts with label ETL. Show all posts
Showing posts with label ETL. Show all posts

Sunday, 2 September 2018

Restore Database without Log File (Just MDF File)

Everyone of us come across this one day or the other to restore database where we don't have a log file or the log file so here us the way we can restore such database without much effort


Script 

EXEC sp_attach_single_file_db @dbname='AdventureWorks',@physname='E:\Program Files\Microsoft SQL Server\DATA\AdventureWorksDW2012_Data.mdf'

Screenshot

Saturday, 1 September 2018

Adding Foreign Key to an existing SQL Table

Today I came across this and was having issue with adding Foreign Key to an existing Table so thought share this with community with aspiration that someone would get help of it.


ALTER TABLE [dbo].[REQUEST]
ADD CONSTRAINT FK_LineManager_ListCode FOREIGN KEY ([LineManager_Name])
REFERENCES [dbo].[MANAGER_LIST](ListCode);