Monthly Archive » January 2015

Adding linked servers in SQL farm

Handy lines for adding linked servers in your SQL farm:

   exec sp_addlinkedserver @server = ‘SQLSERVERNAME’, @srvproduct = N”, @provider=N’SQLNCLI’, @datasrc = ‘SERVERNAME’

   exec sp_addlinkedsrvlogin @rmtsrvname = ‘SQLSERVERNAME’, @useself = ‘false’, @locallogin = ‘login_svc’, @rmtuser = ‘user_svc’, @rmtpassword = ‘********’

 

SQL function to split string

Here’s a handy user defined function to split string into comma separated line:

/****** Object: UserDefinedFunction [dbo].[ufnSplitString] Script Date: 19/11/2015 11:18:20 AM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE FUNCTION [dbo].[ufnSplitString](

@String varchar(max),

@Delimiter char(1),

@Column int = 1

)

Read More