Access SQL Server Instance from the network

Whenever we create any SQL instance and after that if we want to access from our network. We need to setup some setting on Client Machine also! This is  only point that people missed Now we need to install the Client Network Utility on Client Machine and following setting needs to be done. Open Client Network Utility Go to “Alias” Tab Click on “Add…” Button Just type the Server alias (see eg. ABC-1111) “ABC-1” is server name and “111” instance

» Read more

Linked Server

——————————————————— Create  Linked Server through Scripts ——————————————————— USE [master] GO EXEC sp_addlinkedserver @server=’dsql2k’, @srvproduct=”, @provider=’SQLNCLI’, @datasrc=’source_name’ GO USE [master] GO EXEC master.dbo.sp_serveroption @server=N’dsql2k’, @optname=N’rpc’, @optvalue=N’true’ GO EXEC master.dbo.sp_serveroption @server=N’dsql2k’, @optname=N’rpc out’, @optvalue=N’true’ GO select * from master.dbo.sysservers ————————————————————————— Alternative Script to Create Linked Server and Mapping of Users ————————————————————————— Use Master go EXEC master.dbo.sp_addlinkedserver @server = N’dsql2k’, @srvproduct=N”, @provider=N’SQLOLEDB’, @datasrc=N’testserver’ GO EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N’dsql2k’, @locallogin = N’sa’, @useself = N’False’, @rmtuser = N’sa’, @rmtpassword = N’sa’ GO

» Read more

SQL Backup Plan with Dynamic file Name

DECLARE @day VARCHAR(5) DECLARE @month VARCHAR(15) DECLARE @year VARCHAR(5) DECLARE @hour VARCHAR(5) DECLARE @filename VARCHAR(500) SET @day = DATENAME(DAY, GETDATE()) SET @month = DATENAME(MONTH, GETDATE()) SET @year = DATENAME(YEAR, GETDATE()) SET @hour = DATENAME(HOUR, GETDATE()) SET @filename = ‘D:DATABASE Backupdb_name_’ + @day + @month + @year + @hour + ‘.bak’ Backup DATABASE db_name TO Disk = @filename WITH format BACKUP log db_name TO disk = @filename WITH format

» Read more

Move SQL Server Databases Using Detach and Attach

–How to move SQL Server databases to a new location by using Detach and Attach functions in SQL Server –Prerequisites –Note You can determine the name and the current location of all files that a database uses by using the sp_helpfile stored procedure use go sp_helpfile go –Detach the database as follows: use master go sp_detach_db ‘mydb’ go –Next, copy the data files and the log files from the current location (D:Mssql7Data) to the new location (E:Sqldata). –Re-attach the database.

» Read more
1 4 5 6