Skip to content

Instantly share code, notes, and snippets.

@olivier-spinelli
Last active December 12, 2015 01:29
Show Gist options
  • Save olivier-spinelli/4691651 to your computer and use it in GitHub Desktop.
Save olivier-spinelli/4691651 to your computer and use it in GitHub Desktop.
-- This can be executed (star comments may occur between name parts).
create view [dbo]/*C1*/./*C2*/vTest
as
select * from sys.tables;
GO
-- The view is correctly created...
select * from dbo.vTest;
select * from dbo/*C*/./*C*/vTest;
GO
-- But... this is what is generated :-).
create view [dbo].[vTest]/*C1*/./*C2*/vTest
as
select * from sys.tables;
GO
-- Even if it seems that the content has been correctly stored.
exec sp_helptext 'dbo.vTest'
-- outputs:
-- create view [dbo]/*C1*/./*C2*/vTest
-- as
-- select * from sys.tables;
select * from [AdventureWorks2012]/*C1*/
./*C2*/[HumanResources] -- C3
/*C4*/./*C5*/ [Department];
select ₣ /*Comment*/ -35;
select [yes!
a quoted indentifier,
can span multiple lines...
Horrible isn't it?
:-(] = 'Oumpf...';
select "yes!
a quoted indentifier,
can span multiple lines...
Horrible isn't it?
:-(" = 'And with double quotes';
select " " = 'one space';
select "
" = 'new line...';
select "[]" = 'bracket inside.';
select "[[[[[[[]" = 'brackets inside.';
select [""] = 'quote inside.';
select "a "" inside..." = 'double quote inside :-)';
select [and [double]] inside...] = 'double ] is also supported!';
-- Two identical tokens...
create table dbo.tTest
(
[int] [int] null
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment