Friday, October 4, 2019

VSCode USing GOLang

VSCode installation for GO.

before installing,  unintall vscode delete all the related vscode files in programs,appadata folders if it is already installed and.

creating the workspace
file->openworkspace


1. install go using extensions and restart VSCode

2. go to view->commandpalette->go_install/update, select all and ok.

 3. npm install -g yo generator-code

instal c#, c#extensions
test the example
package main

import "fmt"

func main() {
    fmt.Println("Hello")
}

Monday, May 6, 2019

how to disable and enable the triggers in SQL to increase the SQL execution time

//Disable
Declare @SQLTrigger varchar(max)
 set @SQLTrigger=  'dbo.sp_MSforeachtable @command1='+'"'+'DISABLE TRIGGER ALL ON ?'+'" '
 exec(@SQLTrigger)


//Enable
 Declare @SQLTrigger varchar(max)
 set @SQLTrigger=  'dbo.sp_MSforeachtable @command1='+'"'+'Enable TRIGGER ALL ON ?'+'" '
 exec(@SQLTrigger)

To disable and enable all constraints on a database

//DIsable

EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"


//ENable
EXEC sp_msforeachtable "ALTER TABLE ? CHECK CONSTRAINT all"

To know reference tables(foreign key) for a table, SQLSERVer

SELECT CONSTRAINT_NAME = name,
       FOREIGN_SCHEMA = OBJECT_SCHEMA_NAME(parent_object_id),
       FOREIGN_TABLE = OBJECT_NAME(parent_object_id),
       REFERENCED_SCHEMA = OBJECT_SCHEMA_NAME(referenced_object_id),
       REFERENCED_TABLE = OBJECT_NAME(referenced_object_id)
FROM sys.foreign_keys
WHERE OBJECT_NAME(referenced_object_id) = 'TableName';
GO