Format:
Recent snippets matching tags of sql
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\100\Tools\Shell\FontAndColors\{A27B4E24-A735-4D1D-B8E7-9716E1E3D8E0}]
"Colorable item format version"=dword:00000008
"Plain Text Foreground"=dword:00e0e0e0
"Plain Text Background"=dword:00303030
"Plain Text FontFlags"=dword:00000000
"Selected Text Foreground"=dword:00000000
"Selected Text Background"=dword:00c0c0c0
"Selected Text FontFlags"=dword:00000000
58 Views
no comments
CREATE DATABASE dawnoises; CREATE TABLE produse( cod_produs number(10) not null primary key, cod_producator number(10) not null, denumire varchar(30), tip number(3) not null, cantitate number(8,2), um char(3), pret number(8,2)
41 Views
no comments
GO DBCC SHRINKFILE(DB_log, 1) BACKUP LOG DDBWITH TRUNCATE_ONLY DBCC SHRINKFILE(DB_log, 1) GO
45 Views
no comments
private static bool AttemptInsertUniqueItem<T>(T item, Action<T> insert) { bool success = false; try { insert(item); success = true; } catch (SqlException sqlEx)
59 Views
no comments
SELECT column_name , table_name FROM information_schema.columns order by table_name, column_name
35 Views
no comments
create proc a as select 1 as c1 , 'a' as a into #t --select * from #t exec bb go
40 Views
no comments
<roleManager enabled="true" defaultProvider="MySQLRole"> <providers> <clear/> <add name="MySQLRole" connectionStringName="MySQLConStr" applicationName="/" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> </providers> </roleManager>
58 Views
no comments
<membership defaultProvider="MySQLMembership"> <providers> <clear/> <add name="MySQLMembership" connectionStringName="MySQLConStr" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false"
70 Views
no comments
public class SqlAppender : AppenderSkeleton { private static readonly string CommandText = "INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)"; public string ConnectionString { get; set; } protected override void Append(LoggingEvent loggingEvent) { using (var conn = new SqlConnection(ConnectionString)) using (var cmd = new SqlCommand(CommandText, conn))
64 Views
no comments
Set NoCount ON Declare @tableName varchar(200) set @tableName='' While exists (
56 Views
no comments
DECLARE @RandomNumber float DECLARE @RandomInteger int DECLARE @MaxValue int DECLARE @MinValue int SET @MaxValue = 4 SET @MinValue = 2 SELECT @RandomNumber = RAND()
84 Views
no comments
backup log <Database_Name, sysname, Database_Name> with truncate_only go use <Database_Name, sysname, Database_Name> go dbcc shrinkfile (<Database_Name, sysname, Database_Name>_log, 2) go DBCC SHRINKDATABASE(N'<Database_Name, sysname, Database_Name>' )
52 Views
no comments
-- Disable All constraint (FK) EXECUTE sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT ALL" GO -- Enable EXECUTE sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL" GO
67 Views
no comments
set nocount on -- build a working table called x if (object_id('x') is not null) drop table x create table x (col1 varchar(50)) declare @sql nvarchar(500) set @sql = 'insert into x select ''test'';'
73 Views
1 comments
set nocount on use tempdb if (object_id('x') is not null) drop table x create table x (id int primary key identity(1, 1), date datetime, value bigint, total bigint) declare @x table(id int, date datetime, value bigint, total bigint) declare @d datetime
140 Views
no comments
-- sample table create table [tb_Temp] ([Col1] varchar(10), [Col2] varchar(10)) -- sample data GO insert into [tb_Temp] values ('dog', 'brown') ,('dog', 'black')
100 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Xml; using System.Runtime.Serialization; using System.Data.Linq; using System.Data.Linq.Mapping; using System.Linq.Expressions;
449 Views
no comments
declare @x int, @y int, @z int set @x = 1 set @y = 2 set @z = 1 -- returns @x (because not equal) select case when @x = @y then null else @x end -- returns null (because equal) select case when @x = @z then null else @x end
116 Views
no comments
'1/1/2000 1:30 AM' != '1/1/2000 1:31 AM' -- /// DECLARE @x datetime SET @x = GETDATE() SET @x = CONVERT(varchar, @x, 101) -- ///
143 Views
no comments
-- clean up any test artifacts if object_id('test1') is not null drop table test1 if object_id('test2') is not null drop table test2 if object_id('test') is not null drop view test GO -- the partition column must have a CHECK -- and be part of the PRIMARY KEY create table test1 (col1 int primary key check (col1 = 1), col2 varchar(50))
92 Views
no comments
<#@ template language="C#v3.5" hostspecific="True" debug="True" #> <#@ output extension="cs" #> <#@ assembly name="Microsoft.SqlServer.ConnectionInfo" #> <#@ assembly name="Microsoft.SqlServer.Smo" #> <#@ assembly name="System.Data" #> <#@ import namespace="Microsoft.SqlServer.Management.Smo" #> <#@ import namespace="Microsoft.SqlServer.Management.Common" #> <#@ import namespace="System.Data.SqlClient" #> <#@ import namespace="System.Collections.Specialized" #> <#
279 Views
no comments
SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) select convert(varchar(10),getdate(),121) CONVERT(VARCHAR,start_dttm,111)
64 Views
no comments
DECLARE @ParamFromDate datetime DECLARE @ParamToDate datetime DECLARE @ParamQueues varchar(50) DECLARE @CurrentDate DATETIME DECLARE @L_Start varchar(50) DECLARE @L_End varchar(50) DECLARE @LSQL as varchar(1500) DECLARE @LCOL as varchar(50) DECLARE @TableName1 varchar(50) DECLARE @TableName2 varchar(50)
57 Views
no comments
function global:out-zip($path){ $files = $input if (-not $path.EndsWith('.zip')) {$path += '.zip'} if (-not (test-path $path)) { set-content $path ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18)) } $zip=resolve-path($path) $ZipFile = (new-object -com shell.application).NameSpace( "$zip" )
380 Views
1 comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
