ERD Notation

Relationships illustrate an association between two tables. In the physical data model, relationships are represented by stylized lines. Cardinality and ordinality, respectively, refer to the maximum number of times an instance in one entity can be associated with instances in the related entity, and the minimum number of times an instance in one entity can [...]

By |2016-02-18T22:21:23+02:00February 18th, 2016|0 Comments

DELETE BULK

WHILE @@ROWCOUNT <> 0 BEGIN DELETE TOP (1000000) FROM [database].[schema].[table] WHERE [Col1] = 'abc' DBCC SHRINKDATABASE(N'_APPL' ) END

By |2015-06-15T22:01:20+02:00June 15th, 2015|0 Comments

context connection (SQL CLR)

using (System.Data.SqlClient.SqlConnection _SQLConnection = new System.Data.SqlClient.SqlConnection("context connection=true")) { // SQL Connection öffnen _SQLConnection.Open(); } MSDN Artikel

By |2015-06-15T21:25:48+02:00June 15th, 2015|0 Comments

CURSOR

DECLARE @Cursor_Text varchar(255) DECLARE Cursor_1 CURSOR LOCAL STATIC READ_ONLY FOR SELECT [Text] FROM Table OPEN Cursor_1 FETCH NEXT FROM Cursor_1 INTO @Cursor_Text WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM Cursor_1 INTO @Cursor_Text END CLOSE Cursor_1 DEALLOCATE Cursor_1

By |2015-06-13T22:54:57+02:00June 10th, 2015|0 Comments

CROSS/OUTER APPLY

There are two types of APPLY: CROSS APPLY and OUTER APPLY. CROSS APPLY returns only rows from the outer table that create a result set of table-valued function. OUTER APPLY returns both rows that create a result set as well as those rows where this is not the case. By table-valued function NULL values are [...]

By |2015-06-13T22:54:46+02:00June 10th, 2015|0 Comments

FOR XML

SELECT [Key] AS [Key], Left((SELECT CONVERT(varchar(50), [ID]) + ',' FROM [_META].[_addresses].[DetailKeys] WHERE [Key] = dk.[Key] FOR XML PATH('')), LEN((SELECT CONVERT(varchar(50), [ID]) + ',' FROM [_META].[_addresses].[DetailKeys] WHERE [Key] = dk.[Key] FOR XML PATH(''))) - 1) AS [IDs] FROM [_META].[_addresses].[DetailKeys] dk GROUP BY [Key]

By |2015-06-13T22:55:07+02:00June 10th, 2015|0 Comments