블로그 이미지
SQL Server VS. 석이 minsouk@hotmail.com MSSQL 쿼리성능 관련해 궁금한 사항이 있다면 언제나 누구나 TeamViewer + Line (네이버 japan 메신저) 에 minsouk1 추가 후 연락주세요~ 010-9967-0955 보미아빠

카테고리

보미아빠, 석이 (452)
밥벌이 (16)
싸이클 (1)
일상 (1)
Total222,037
Today129
Yesterday150

달력

« » 2018.10
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

공지사항

function base n

분류없음 / 2018.05.29 18:07

/****** Object:  UserDefinedFunction [dbo].[F_NUMERIC_TO_BASE_N]    Script Date: 5/29/2018 6:07:05 PM ******/

SET ANSI_NULLS ON

GO


SET QUOTED_IDENTIFIER ON

GO


create function [dbo].[F_NUMERIC_TO_BASE_N]

(

@Number numeric(32,0),

@Base int

)

returns varchar(110)

as


/*

Function: F_NUMERIC_TO_BASE_N


Function F_NUMERIC_TO_BASE_N converts a numeric(32,0) value, @Number,

to a string of digits in number base @Base,

where @Base is between 2 and 36.


Output digits greater than 9 are represented by

uppercase letters A through Z, where A = 10 through Z = 35.

 

If input parameter @Number is negative, the output string

will have a minus sign in the leftmost position.


Any non-null numeric(32,0) value for parameter @Number is valid:

-99999999999999999999999999999999 through

99999999999999999999999999999999.


If input parameters @Number or @Base are null,

or @Base is not between 2 and 36,

then the function returns a null value.

*/


begin


declare @Work_Number numeric(38,0)

declare @Modulus int

declare @Digits varchar(36)

declare @Output_String varchar(110)


if @Number is null or @Base is null or @Base < 2 or @Base > 36 

begin

return null

end


set @Digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

set @Output_String = ''

set @Work_Number = @Number


while 1=1  

begin


Set @Modulus = convert(int,abs(@Work_Number-(round(@Work_Number/@Base,0,1)*@Base)))


set @Output_String = substring(@Digits,@Modulus+1,1) + @Output_String


set @Work_Number = round(@Work_Number/@Base,0,1)


if @Work_Number = 0 break

end -- end while


if @Number < 0 set @Output_String = '-'+@Output_String


return @Output_String


end

GO










declare @times bigint = 1

declare @top_count bigint = 1000


select  dbo.[F_NUMERIC_TO_BASE_N](@times * 100000000 + rn * 1000 , 32)

from 

(

select top (@top_count) row_number() over (order by (select 1)) rn 

from sysobjects a 

cross join sysobjects b 

cross join sysobjects c

) a



Posted by 보미아빠

bmw ista+

분류없음 / 2018.05.17 20:16

https://m.blog.naver.com/PostView.nhn?blogId=lauf1&logNo=220781453020&proxyReferer=https%3A%2F%2Fwww.google.co.kr%2F



ista-d torrent


Posted by 보미아빠

multikey dictionary

분류없음 / 2018.04.23 20:35

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace mtest2

{

    class Config

    {

        public class Item : IEquatable<Item>

        {

            private readonly string _X;

            private readonly string _Y;


            public Item(string x, string y)

            {

                _X = x;

                _Y = y;

            }


            public string X

            {

                get { return _X; }

            }


            public string Y

            {

                get { return _Y; }

            }


            public override int GetHashCode()

            {

                return _X.GetHashCode() ^ _Y.GetHashCode();

            }



            public bool Equals(Item other)

            {

                if (_X != other._X)

                    return false;


                return _Y == other._Y;

            }            


        }

    }

}




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mtest2
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<Config.Item, string> dicReloadedItems = new Dictionary<Config.Item, string>();
            Dictionary<Config.Item, string> dicCurrentItems = new Dictionary<Config.Item, string>();
            dicReloadedItems.Add(new Config.Item("1key", "1value"), "dic.1value");
            dicReloadedItems.Add(new Config.Item("2key", "2value"), "dic.2value");
            dicReloadedItems.Add(new Config.Item("3key", "3value"), "dic.3value");

            dicCurrentItems.Add(new Config.Item("3key", "3value"), "dic.3value");
            dicCurrentItems.Add(new Config.Item("4key", "4value"), "dic.4value");

            foreach (var dicReloadedItem in dicReloadedItems)
            {
                if (!dicCurrentItems.ContainsKey(dicReloadedItem.Key))
                {
                    Console.WriteLine(string.Format("a{0}, {1}", dicReloadedItem.Key.X, dicReloadedItem.Key.Y));
                }
            }
            Console.ReadKey();
        }
    }
}






//-----------------------------------------------------------------------------------------

// tuple 이용하기 .net 4.0 이상 조오타~~~

//-----------------------------------------------------------------------------------------


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace mtest2

{

    class Program

    {

        static void Main(string[] args)

        {

            Dictionary<Tuple<string, string>, string> dicReloadedItems = new Dictionary<Tuple<string, string>, string>();

            Dictionary<Tuple<string, string>, string> dicCurrentItems = new Dictionary<Tuple<string, string>, string>();

            dicReloadedItems.Add(new Tuple<string, string>("1key", "1value"), "dic.1value");

            dicReloadedItems.Add(new Tuple<string, string>("2key", "2value"), "dic.2value");

            dicReloadedItems.Add(new Tuple<string, string>("3key", "3value"), "dic.3value");


            dicCurrentItems.Add(new Tuple<string, string>("3key", "3value"), "dic.3value");

            dicCurrentItems.Add(new Tuple<string, string>("4key", "4value"), "dic.4value");


            foreach (var dicReloadedItem in dicReloadedItems)

            {

                if (!dicCurrentItems.ContainsKey(dicReloadedItem.Key))

                {

                    Console.WriteLine(string.Format("a{0}, {1}", dicReloadedItem.Key.Item1, dicReloadedItem.Key.Item2));

                }

            }

            Console.ReadKey();

        }

    }

}



Posted by 보미아빠

최근에 달린 댓글

최근에 받은 트랙백

글 보관함