Script SQL Server
Clean Up - Old files and references sizes in C# to SSIS
You can use this code to do the cleaning up by date or name file lengthYou can use this code to do the cleaning up by date or name file lenght#region Namespacesusing System;using System.Data;using Microsoft.SqlServer.Dts.Runtime;using...
Search SQL Packages
SELECT 'SSISPackages' AS [Source], [name] AS [SourceId], [name] as [PackageName], [description] as [PackageDescription], @@SERVERNAME as [ServerName], case [packagetype] WHEN 0 then 'Undefined' WHEN 1 then 'SQL Server Import and Export Wizard' WHEN 2 then 'DTS Designer in SQL Server 2000' WHEN 3...
Search SQL Jobs
SELECT distinct 'JobsandSteps' AS [Source], [sJSTP].[step_uid] AS [SourceId], 'SQL Server Job' AS [ProcessType], [sCAT].[name] AS [BusinessProcessSourceId], @@SERVERNAME as [ServerName], [sJOB].[name] AS [SQLServerJobSourceId],[sJSTP].[step_id] AS [StepSequence], [sJSTP].[step_name] AS...
Terminal Service - Handle session by SQL Server Transaction
I'm sharing with you some commands which you can use to handle some server sessions:--// Identify who are connected:xp_cmdshell 'query session'--// Identify the server nameselect @@servername--// Send the alert message (change the server name and ID number):xp_cmdshell 'msg /server:server_name 3...
SQL SERVER – Simple Example of Creating XML File Using T-SQL
I always want to learn SQL Server and XML. Let us go over very simple example today about how to create XML using SQL Server.
Please also read related article here SQL SERVER – Simple Example of Reading XML File Using T-SQL.
Following is the XML which we want to create:
T-SQL Script to...
SQL SERVER – Simple Example of Reading XML File Using T-SQL
In one of the previous article we have seen how we can create XML file using SELECT statementSQL SERVER – Simple Example of Creating XML File Using T-SQL. Today we will see how we can read the XML file using the SELECT statement.
Following is the XML which we will read using T-SQL:
Following is...
SQL SERVER – Server Side Paging in SQL Server Denali – A Better Alternative
USE AdventureWorks2008R2
GO
DECLARE @RowsPerPage INT = 10, @PageNumber INT = 5
SELECT *
FROM Sales.SalesOrderDetail
ORDER BY SalesOrderDetailID
OFFSET @PageNumber*@RowsPerPage ROWS
FETCH NEXT 10 ROWS ONLY
GO
I consider it good...
Como mudar o proprietário de um objeto
EXEC sp_changeobjectowner ‘XPTO′, ‘DBO’
Executar comando ao reiniciar o SQL Server (Startup)
Fazendo que uma rotina própria seja executada toda vez que o servidor é iniciado
A idéia é marcar a sua Stored Procedure para executar toda a vez que o serviço MSSQLServer for iniciado com a system stored procedure sp_procoption.
Por exemplo, vamos habilitar a st_webmundi para ser executada:
USE...
Número aleatório no T-SQL (Rand Number)
Selecionando um valor aleatório no banco de dados MS-SQL Server
O Ms-Sql Server possui uma função que retorna valores aleatórios.
Esta é uma funcionalidade da função RAND().
O único problema é que ela só retorna os números entre 0 e 1
(Exemplo.: 0.494443).
Para fazer com que ele retorne...