Skip to main content

Posts

Showing posts with the label Change Server Name in SQL Server

Execute Function in Stored Procedure SQL Server

--CREATE A FUNCTION FOR ADD TWO USER INPUT VALUES. CREATE FUNCTION AddFun_sp (@NumIst INT , @NumpIInd INT ) RETURNS INT AS BEGIN DECLARE @Result as int SET @Result = @NumIst + @NumpIInd RETURN @Result END --CALL A FUNCTION IN STORE PROCEDURE. CREATE PROCEDURE usp_CallAfunction ( @IstVar INT , @IIndVar INT ) AS BEGIN DECLARE @sp AS INT SET @sp = dbo . AddFun1 (@IstVar,@IIndVar) PRINT @sp END --EXECUTE STORE PROCEDURE FOR OUTPUT RESULT. EXECUTE dbo . usp_CallAfunction '10' , '20' --RESULT IS 30

Change Server Name in SQL Server

Hello Everyone,   Today, I have a Requirement to change server the name of SQL Server , After completed this task  going to share the sample query for change the server name in SQL Server . Some Noted Point Keep in Mind which are given below 1.    If SQL Server is clustered then you should not rename the server name otherwise you rename it. 2.    If you are using replication in SQL Server then can't change server name. 3.    If you are installed the Reporting Service that time you not rename or change the server name. First you run below query and find the detail about you SQL like Host Name, Server Name, Machine Name, Net BOIS name and last one SQL Server is clustered or not.   SELECT   HOST_NAME () AS 'HOSTNAME' ,                         @@SERVERNAME AS 'SERVERNAME' ,    ...