This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT 'tempdb' as db, TABLE_NAME, COLUMN_NAME, COLLATION_NAME | |
FROM tempdb.INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME like '#RockStarInfo3%' | |
AND TABLE_SCHEMA = current_user | |
AND COLUMN_NAME = 'name' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION dbo.fn_strip_zeros(@number numeric(38,10)) | |
RETURNS varchar(38) | |
WITH ENCRYPTION | |
AS | |
BEGIN | |
DECLARE @result varchar(38) | |
DECLARE @decimal varchar(3) | |
SET @decimal = substring(convert(varchar(38), convert(numeric(38,10),1)/5 ), 2,1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IF EXISTS(SELECT * FROM sys.schemas WHERE name ='xml_raw_schema') | |
DROP XML SCHEMA COLLECTION dbo.xml_raw_schema | |
GO | |
CREATE XML SCHEMA COLLECTION xml_raw_schema AS | |
N'<?xml version="1.0"?> | |
<xsd:schema xmlns:targetNamespace="http://schemas.mycompany.com/myproduct" | |
elementFormDefault="qualified" | |
attributeFormDefault="unqualified" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @xml xml(xml_raw_schema) | |
SET @xml = (select * from sys.tables FOR XML RAW, TYPE, ROOT('table')) | |
select @xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<row name="Orders" object_id="2073058421" schema_id="1" parent_object_id="0" type="U " type_desc="USER_TABLE" create_date="2007-04-12T17:30:08.150" modify_date="2007-04-12T17:46:17.043" is_ms_shipped="0" is_published="0" is_schema_published="0" lob_data_space_id="0" max_column_id_used="3" lock_on_bulk_load="0" uses_ansi_nulls="1" is_replicated="0" has_replication_filter="0" is_merge_published="0" is_sync_tran_subscribed="0" has_unchecked_assembly_data="0" text_in_row_limit="0" large_value_types_out_of_row="0" /> | |
</table> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UserShortcuts> | |
<RemoveShortcut Command="Window.NextDocumentWindowNav" Scope="Global">Ctrl+Tab</RemoveShortcut> | |
<Shortcut Command="Window.NextDocumentWindow" Scope="Global">Ctrl+Tab</Shortcut> | |
<Shortcut Command="Window.NextDocumentWindow" Scope="Query Designer">Ctrl+Tab</Shortcut> | |
<RemoveShortcut Command="Window.PreviousDocumentWindowNav" Scope="Global">Ctrl+Shift+Tab</RemoveShortcut> | |
<Shortcut Command="Window.PreviousDocumentWindow" Scope="Global">Ctrl+Shift+Tab</Shortcut> | |
<Shortcut Command="Window.PreviousDocumentWindow" Scope="Query Designer">Ctrl+Shift+Tab</Shortcut> | |
</UserShortcuts> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE master | |
IF EXISTS(SELECT * FROM sys.objects WHERE name = 'sp_help_partition') | |
BEGIN | |
PRINT 'Dropping procedure sp_help_partition...' | |
DROP PROCEDURE sp_help_partition | |
END | |
print 'Creating procedure sp_help_partition...' | |
GO | |
CREATE PROCEDURE sp_help_partition (@object_name sysname = NULL) | |
AS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec sp_help_partition 'Orders' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table updatetest | |
( | |
id int primary key, | |
name varchar(20), | |
amount numeric | |
) | |
insert into updatetest values (1, 'first', 100) | |
insert into updatetest values (2, 'second', 500) | |
insert into updatetest values (3, 'third', 30) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE updatevalues(@id int, | |
@name varchar(20), | |
@amount numeric) | |
AS | |
IF EXISTS(SELECT * FROM updatetest WHERE id = @id) | |
BEGIN | |
UPDATE updatetest | |
SET name = @name, | |
amount= @amount |