UPDATE Cv
SET cv.Id = CT.Id
FROM XYZ.[dbo].[tblP] CV
INNER JOIN ABC.[dbo].[tblP] CT
ON CV. Id = CT. Id
use master GO alter endpoint endpoint_name state = stopped; GO alter endpoint endpoint_name state = started; GO
CREATE PROCEDURE sp_test
AS
SELECT * FROM dbo.test
GO
Rename:
sp_rename 'SP_test', 'SP_test2'
USE DBNAME
GO
sp_helptext sptest2
We will see the name of the stored procedure is the old name and not the new
name but when we try to access the old name
USE DBNAME
GO
sp_helptext sptest
there is an error that sp
not found.
NOTE:
Thanks
CREATE TABLE [dbo].[tblState]
( [StateName] [varchar](50) NULL, [StateCode] [varchar](4) NULL ) insert into dbo.tblState (StateName,StateCode) Select 'Alabama', 'AL' UNION ALL Select 'Alaska', 'AK' UNION ALL Select 'Arizona', 'AZ' UNION ALL Select 'Arkansas', 'AR' UNION ALL Select 'California', 'CA' UNION ALL Select 'Colorado', 'CO' UNION ALL Select 'Connecticut', 'CT' UNION ALL Select 'Delaware', 'DE' UNION ALL Select 'District of Columbia', 'DC' UNION ALL Select 'Florida', 'FL' UNION ALL Select 'Georgia', 'GA' UNION ALL Select 'Hawaii', 'HI' UNION ALL Select 'Idaho', 'ID' UNION ALL Select 'Illinois', 'IL' UNION ALL Select 'Indiana', 'IN' UNION ALL Select 'Iowa', 'IA' UNION ALL Select 'Kansas', 'KS' UNION ALL Select 'Kentucky', 'KY' UNION ALL Select 'Louisiana', 'LA' UNION ALL Select 'Maine', 'ME' UNION ALL Select 'Maryland', 'MD' UNION ALL Select 'Massachusetts', 'MA' UNION ALL Select 'Michigan', 'MI' UNION ALL Select 'Minnesota', 'MN' UNION ALL Select 'Mississippi', 'MS' UNION ALL Select 'Missouri', 'MO' UNION ALL Select 'Montana', 'MT' UNION ALL Select 'Nebraska', 'NE' UNION ALL Select 'Nevada', 'NV' UNION ALL Select 'New Hampshire', 'NH' UNION ALL Select 'New Jersey', 'NJ' UNION ALL Select 'New Mexico', 'NM' UNION ALL Select 'New York', 'NY' UNION ALL Select 'North Carolina', 'NC' UNION ALL Select 'North Dakota', 'ND' UNION ALL Select 'Ohio', 'OH' UNION ALL Select 'Oklahoma', 'OK' UNION ALL Select 'Oregon', 'OR' UNION ALL Select 'Pennsylvania', 'PA' UNION ALL Select 'Rhode Island', 'RI' UNION ALL Select 'South Carolina', 'SC' UNION ALL Select 'South Dakota', 'SD' UNION ALL Select 'Tennessee', 'TN' UNION ALL Select 'Texas', 'TX' UNION ALL Select 'Utah', 'UT' UNION ALL Select 'Vermont', 'VT' UNION ALL Select 'Virginia', 'VA' UNION ALL Select 'Washington', 'WA' UNION ALL Select 'West Virginia', 'WV' UNION ALL Select 'Wisconsin', 'WI' UNION ALL Select 'Wyoming', 'WY'
Thanks
https://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context...