Format:
Recent snippets matching language of SQL
echo Running prop 104 again even though it is done timex dbaccess $DB_NAME<<! execute procedure gamtrpcmp_convert(104,1000,24); !
3 Views
no comments
DECLARE @StartDate DATETIME ,@EndDate DATETIME SET @StartDate = '1/26/2012' SET @EndDate = '1/26/2012'; WITH MultiplePaymentCTE (orderID, TaxPerPayType, ShipPerPayType, DiscountPerPayType, PayTypeCount) AS ( SELECT
10 Views
no comments
SELECT oid,pid,ptype,date,status,efamt, description AS descr, FORMAT(amt,2) AS amt, IFNULL(DATE_FORMAT(date,"%b %d, %Y"),"None") as date FROM ( (SELECT ORD1.orders_id AS oid, OCCA.id AS pid, "Credit Card" AS ptype, OCCA.tran_date AS date, "Charged" AS status,
32 Views
no comments
USE [msdb] GO /****** Object: Job [iERP85_ExpandGLPeriods] Script Date: 02/01/2012 10:45:58 ******/ BEGIN TRANSACTION DECLARE @ReturnCode INT SELECT @ReturnCode = 0 /****** Object: JobCategory [[Uncategorized (Local)]]] Script Date: 02/01/2012 10:45:58 ******/ IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'[Uncategorized (Local)]' AND category_class=1) BEGIN
16 Views
no comments
/************************************************************************************* * * Copyright 2012 Davide Orazio Montersino http://www.davidemontersino.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or
27 Views
no comments
SELECT * FROM ( SELECT 60 * (EXTRACT (HOUR FROM INSERTED_DATE) - 12) + EXTRACT (MINUTE FROM INSERTED_DATE) AS MINUTE, COUNT (E.ID_EVENT) / 60 AS FRAMESPERSECONDE FROM EVENT E WHERE INSERTED_DATE > TO_TIMESTAMP ('23122011 12:00:00', 'DDMMYYYY HH24:MI:SS') GROUP BY EXTRACT (HOUR FROM INSERTED_DATE),
19 Views
no comments
SELECT INSERTED_DATE FROM ( SELECT * FROM EVENT E ORDER BY E.INSERTED_DATE DESC) WHERE ROWNUM < 100;
26 Views
no comments
CREATE PROC SearchAllTables ( @SearchStr nvarchar(100) ) AS BEGIN CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630)) SET NOCOUNT ON
31 Views
no comments
SELECT o.name, c.text FROM sysobjects o INNER JOIN syscomments c ON o.id = c.id WHERE xtype = 'P' AND CharIndex('<KEYWORD>',c.text) > 0 ORDER BY o.name
39 Views
no comments
Select * From dbo.SysObjects where xtype = 'P'
26 Views
no comments
select name as 'Database Name', [dbid] from master.dbo.sysdatabases
35 Views
no comments
/* Since you cant alter the database straight away, you first need to kill the user thats currently connected to it... So... Step 1: Get the session thats connected to that database */ select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame from master.dbo.sysprocesses p inner join master.dbo.sysdatabases d on p.dbid = d.dbid where d.name = 'DATABASE NAME GOES HERE'
32 Views
no comments
-- --- -- Globals -- --- -- SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- SET FOREIGN_KEY_CHECKS=0; -- --- -- Table 'tblUsers'
42 Views
no comments
-- Create linked server EXEC sp_addlinkedserver @server = N'<linked server name>', @srvproduct = N'Oracle', @provider = N'MSDAORA', @datasrc = N'<TNS names>'; GO -- Configure linked server credentials EXEC sp_addlinkedsrvlogin
38 Views
no comments
/* Ordered Jobs Kata http://invalidcast.com/2011/09/the-ordered-jobs-kata Sherwin Rice 30/09/2011 */ USE TempDB /*drop & create the OrderTheJobs function */ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OrderTheJobs]') )
86 Views
no comments
alter table Table1 add constraint FK_Table1_Table2 FOREIGN KEY ( Fk_Table1Column ) references Table2(PK_Table2Column)
50 Views
no comments
declare @tablevar table(spid int, dbid int, objid int, indid int, [type] varchar(64), resource varchar(64), mode varchar(64), status varchar(64)) insert into @tablevar exec sp_lock select spid, dbid, ObjId, object_name( objid), IndId, [type], Resource, Mode, Status from @tablevar
58 Views
no comments
-- -- Dump object names for any locks currently waiting -- declare @tablevar table(spid int, dbid int, objid int, indid int, [type] varchar(64), resource varchar(64), mode varchar(64), status varchar(64)) insert into @tablevar exec sp_lock select object_name( objid) from @tablevar where status = 'WAIT'
47 Views
no comments
begin transaction rollback transaction
59 Views
no comments
CREATE TABLE IF NOT EXISTS `atbats` ( `ab_id` mediumint(9) unsigned NOT NULL AUTO_INCREMENT, `game_id` smallint(6) unsigned NOT NULL, `inning` tinyint(2) unsigned NOT NULL, `half` tinyint(1) unsigned DEFAULT '0', `num` tinyint(3) unsigned NOT NULL, `ball` tinyint(1) unsigned NOT NULL, `strike` tinyint(1) unsigned NOT NULL, `outs` tinyint(1) unsigned NOT NULL, `batter` mediumint(6) unsigned NOT NULL,
168 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
