milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home
  3. MS SQL

Drop if exists

Details
Written by: Stanko Milosev
Category: MS SQL
Published: 13 March 2020
Last Updated: 13 March 2020
Hits: 2732
Here are few "DROP IF EXISTS" SQL statements, for my future reference.

Trigger from sys.objects:

IF EXISTS (SELECT * FROM sys.objects WHERE [name] = N'myTrigger' AND [type] = 'TR')
BEGIN
      DROP TRIGGER [dbo].[myTrigger];
END;
GO
Stored procedure with OBJECT_ID:
IF OBJECT_ID('dbo.mySP') IS NOT NULL
  DROP PROCEDURE dbo.mySP
GO
Temp table:
IF OBJECT_ID('tempdb..#myTempTable') IS NOT NULL DROP TABLE #myTempTable
GO

The login already has an account under a different user name.

Details
Written by: Stanko Milosev
Category: MS SQL
Published: 11 February 2013
Last Updated: 04 July 2013
Hits: 9343

If you receive error like:

The login already has an account under a different user name. (Microsoft SQL Server, Error: 15063)

Then just take databse offline and back online. Frome here.

Access SQL Server from other machines

Details
Written by: Stanko Milosev
Category: MS SQL
Published: 12 November 2012
Last Updated: 26 December 2012
Hits: 5565

SQL Server Browser has to be enabled so that other machines can access it.

How to change sa password.

Details
Written by: Stanko Milosev
Category: MS SQL
Published: 12 November 2012
Last Updated: 30 November -0001
Hits: 5375

sp_password NULL,'new_password','sa' go

  1. Query to Find Column From All Tables of Database
  2. Select all from all tables in DB
  3. Invoke or BeginInvoke cannot be called on a control until the window handle has been created..
  4. Data into fields

Page 2 of 5

  • 1
  • 2
  • 3
  • 4
  • 5