You might encounter the following error while registering a new server in PG Admin.
Instance '<Server at <guid>>' is not persisted.
The issue is mostly due to uninstalling and re-installing PG Admin or installing a different version of PG Admin.
The resolution would be the following.
- Close PGAdmin
- Browse to
C:\Users\<your user>\AppData\Roaming
- Delete the folder
PGAdmin
- Open PGAdmin
This will resolve the issue
You might need to purge all the data in all the tables in a particular database. For this we can use the following script.
USE <database name>
DECLARE @TableName AS VARCHAR(MAX)
DECLARE table_cursor CURSOR
FOR
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND TABLE_NAME LIKE '%_Partition%'
OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @SQLText AS NVARCHAR(4000)
SET @SQLText = 'TRUNCATE TABLE ' + @TableName
EXEC sp_executeSQL @SQLText
FETCH NEXT FROM table_cursor INTO @TableName
END
CLOSE table_cursor
DEALLOCATE table_cursor
Technical help and scripts for everyday issues of a sysadmin day