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

VB Code for Log or Tracking

Dim LFNum As Integer Dim PLFName As String ‘blnfileopen As Boolean Public Sub OpenFile() LFNum = FreeFile PLFName = App.Path & “proglog” & Format(Day(Date), “00”) & Format(Hour(Time), “00”) & Format(Minute(Time), “00”) & Format(Second(Time), “00”) & “.txt” Open PLFName For Output As LFNum Print #LFNum, “Logging Started at…..” & Date; ” “; Time Print #LFNum, “” ‘blnfileopen = True End Sub Public Sub LogData(msg As String) ‘If Not blnfileopen Then OpenFile Print #LFNum, msg End Sub Public Sub closefile() Print #LFNum,

» 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

News – Announcement for Blog

Dear/Respected All, I am pleased to announce that today i am going to start my blog http://www.varindersandhu.in The primary objective of my blog is to share my experience and notes with all technical persons. It would mean the world to me if you’d stop by my blog at some point. This Message/Post can be forwarded to anyone who might be interested. Sincerely, Varinder Sandhu

» Read more
1 24 25 26