Script SQL Server

SSRS Job Schedule - Subscription

  SELECT C.Name, [Locale], [InactiveFlags], 'Next Run Date' = CASE next_run_date WHEN 0 THEN null ELSE substring(convert(varchar(15),next_run_date),1,4) + '/' + substring(convert(varchar(15),next_run_date),5,2) + '/' + substring(convert(varchar(15),next_run_date),7,2) END, 'Next Run Time' =...

Package distribution SQL Script

Problem I sometimes get requests to copy a database from one server to another without any data. I just need an empty database with just the schema information and no data, how can I do it? Solution There are a few potential solutions to this problem, for example any of the following methods will...

HTML Query Result format

    SET @tableHTML = N'<table>' + N'<tr><th>SpecialOfferID</th> <th>Description</th> <th>Type</th> <th>Category</th> <th>StartDate</th> <th>EndDate</th> </tr>' + CAST ( ( SELECT td =...

FREEPROCCACHE - Execution Plans

To clean up the execution plan:   -- Example 3 (Scalpel) -- Remove one plan from the cache -- Get the plan handle for a cached plan SELECT cp.plan_handle, st.[text] FROM sys.dm_exec_cached_plans AS cp CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st WHERE [text] LIKE...

SQL Split 2014

Select PARSENAME(replace('/Transport/Bus-Accessories/Air-Conditioning','/','.'), 2)

Date Conversion

  First Day Of Current Week.   select CONVERT(varchar,dateadd(week,datediff(week,0,getdate()),0),106) Last Day Of Current Week.   select CONVERT(varchar,dateadd(week,datediff(week,0,getdate()),6),106) First Day Of Last week.   select...

Shows up the last backup restored

WITH lastrestores       AS (SELECT DatabaseName = [d].[name],                  [d].[create_date],           &n

Função apenas Número / Function Only integer

CREATE FUNCTION dbo.Fnonlyint (@Text VARCHAR(8000))  /*****************************************************************************  Name:  dbo.fnOnlyInt  Considers only the numbers.  *************************************************

Query Result in a single line / Resultado em uma linha

SELECT NAME + ', '  FROM   sysobjects  FOR xml path('') 

Reading XML Column

    Example 02 ------------------------------------- <ArrayOfCustomers xmlns:xsd="https://www.w3.org/2001/XMLSchema"                          ...

1 | 2 | 3 | 4 | 5 >>

Crie um site com

  • Totalmente GRÁTIS
  • Centenas de templates
  • Todo em português

Este site foi criado com Webnode. Crie um grátis para você também!