Skip to content

Instantly share code, notes, and snippets.

@BrentOzar
Last active July 9, 2022 21:19
Show Gist options
  • Save BrentOzar/9b08b5ab2b617847dbe4aa0297b4cd5b to your computer and use it in GitHub Desktop.
Save BrentOzar/9b08b5ab2b617847dbe4aa0297b4cd5b to your computer and use it in GitHub Desktop.
CREATE DATABASE [٠০౦০٠];
GO
USE [٠০౦০٠];
GO
CREATE SCHEMA [٠০౦০٠];
GO
CREATE TABLE [٠০౦০٠].[٠০౦০٠]([٠০౦০٠] NVARCHAR(20), [۰০౦০٠] NVARCHAR(20), [٠০౦০۰] NVARCHAR(20), [۰০౦০۰] NVARCHAR(20));
GO
CREATE UNIQUE CLUSTERED INDEX [٠০౦০٠] ON [٠০౦০٠].[٠০౦০٠]([٠০౦০٠], [۰০౦০٠], [٠০౦০۰], [۰০౦০۰]);
GO
INSERT INTO [٠০౦০٠].[٠০౦০٠]([٠০౦০٠], [۰০౦০٠], [٠০౦০۰], [۰০౦০۰])
VALUES (N'[۰০౦০٠]', N'[۰০౦০٠]', N'[٠০౦০۰]', N'[۰০౦০۰]');
GO
CREATE VIEW [٠০౦০٠].[۰০౦০٠] AS SELECT [٠০౦০٠], [۰০౦০٠], [٠০౦০۰], [۰০౦০۰] FROM [٠০౦০٠].[٠০౦০٠];
GO
CREATE PROC [٠০౦০٠].[٠০౦০۰]
@٠০౦০٠ NVARCHAR(20),
@۰০౦০٠ NVARCHAR(20),
@٠০౦০۰ NVARCHAR(20),
@۰০౦০۰ NVARCHAR(20) AS
SELECT [٠০౦০٠], [۰০౦০٠], [٠০౦০۰], [۰০౦০۰]
FROM [٠০౦০٠].[۰০౦০٠]
WHERE [٠০౦০٠] = @٠০౦০٠
AND [۰০౦০٠] = @۰০౦০٠
AND [٠০౦০۰] = @٠০౦০۰
AND [۰০౦০۰] = @۰০౦০۰
ORDER BY [۰০౦০۰], [٠০౦০۰], [۰০౦০٠], [٠০౦০٠];
GO
EXEC [٠০౦০٠].[٠০౦০٠].[٠০౦০۰]
@٠০౦০٠ = N'[۰০౦০۰]',
@۰০౦০٠ = N'[٠০౦০۰]',
@٠০౦০۰ = N'[۰০౦০٠]',
@۰০౦০۰ = N'[٠০౦০٠]'
GO
@pwehland
Copy link

It's actually "Fun With Unicode", not ASCII.
For rubyFeedback and others, here is the answer:

SELECT sc.name, 
	   UNICODE(SUBSTRING(sc.name, 1,1)) uc1,
	   UNICODE(SUBSTRING(sc.name, 5,1)) uc5
FROM sys.objects so
	 JOIN
	 sys.columns sc on so.object_id = sc.object_id
WHERE so.type = 'U'
  and so.name like N'%০౦০%';

@chadbaldwin
Copy link

Leaving this here since every time I try and find this from memory, I usually end up here and then can't find the blog post it came from:
https://www.brentozar.com/archive/2018/06/stupid-t-sql-tricks/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment