Format:
Recent snippets matching tags of TSQL
ALTER PROCEDURE [dbo].[pr_OrderItem_history] ( @PipCode varchar(50), @BarCode varchar(150), @Status Char(10) ) AS BEGIN select PID.PO_ItemID,
53 Views
no comments
----------------------------------------------------------- ----------------------------------------------------------- --- BASIC DATA BASE create database Producction go use [Producction] create table Categorias ( Id int identity (1,1)not null ,Nombre varchar (100)
50 Views
no comments
----------------------------------------------------------- ----------------------------------------------------------- -- SQL Ccommand's help select getdate() select GETUTCDATE () set dateformat mdy select convert(varchar, Fecha, 106) ,convert(varchar, Fecha, 103) ---Kill tables
51 Views
no comments
create function dbo.fn_SpacePascal(@in varchar(500)) RETURNS varchar(500) begin /* by: jerry on: 5/2011 to: seperate PascalCaseWords to Pascal Case Words */ if (@in COLLATE Latin1_General_CS_AS = UPPER(@in))
134 Views
no comments
CREATE FUNCTION [dbo].[udf_StringToTable] ( @string VARCHAR(MAX), @delimiter CHAR(1) ) RETURNS @output TABLE( data VARCHAR(256) ) BEGIN
89 Views
no comments
create function dbo.fn_SpacePascal(@in varchar(500)) RETURNS varchar(500) begin /* by: jerry on: 5/2011 to: seperate PsacalCaseWords to Pascal Case Words */ if (@in COLLATE Latin1_General_CS_AS = UPPER(@in))
146 Views
no comments
CREATE FUNCTION [dbo].[udf_DatesInRange] ( -- Add the parameters for the function here @StartDateTime DateTime, @EndDateTime DateTime ) RETURNS @Dates TABLE ( DateInRange DateTime )
98 Views
no comments
Set NoCount ON Declare @tableName varchar(200) set @tableName='' While exists (
243 Views
no comments
DECLARE @RandomNumber float DECLARE @RandomInteger int DECLARE @MaxValue int DECLARE @MinValue int SET @MaxValue = 4 SET @MinValue = 2 SELECT @RandomNumber = RAND()
370 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
284 Views
no 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
400 Views
1 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
591 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))
353 Views
no comments
CREATE TABLE table1 (id int); INSERT INTO table1 VALUES (1); INSERT INTO table1 VALUES (2); INSERT INTO table1 VALUES (3); CREATE TABLE table2 (id int); INSERT INTO table2 VALUES (2); INSERT INTO table2 VALUES (3); CREATE TABLE table3 (id int);
289 Views
2 comments
SELECT SERVERPROPERTY('BuildClrVersion') AS [BuildClrVersion] GO SELECT SERVERPROPERTY('Collation') AS [Collation] GO SELECT SERVERPROPERTY('CollationID') AS [CollationID] GO SELECT SERVERPROPERTY('ComparisonStyle') AS [ComparisonStyle] GO SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS [ComputerNamePhysicalNetBIOS] GO
440 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
