Replication--将LSN转换成16进制
在复制中经常会使用到16进制的LSN,但在日志fn_dblog中的LSN是数字形式,于是从网上找到以下转换函数
CREATE FUNCTION dbo.fn_convertnumericlsntobinary(
@numericlsn numeric(25,0)
) returns binary(10)
AS
BEGIN
-- Declare components to be one step larger than the intended type
-- to avoid sign overflow problems. For example, convert(smallint, convert(numeric(25,0),65535)) will fail but convert(binary(2),
-- convert(int,convert(numeric(25,0),65535))) will give the
-- intended result of 0xffff.
declare @high4bytelsncomponent bigint,
@mid4bytelsncomponent bigint,
@low2bytelsncomponent int
select @high4bytelsncomponent = convert(bigint, floor(@numericlsn / 1000000000000000))
select @numericlsn = @numericlsn - convert(numeric(25,0), @high4bytelsncomponent) * 1000000000000000
select @mid4bytelsncomponent = convert(bigint,floor(@numericlsn / 100000))
select @numericlsn = @numericlsn - convert(numeric(25,0), @mid4bytelsncomponent) * 100000
select @low2bytelsncomponent = convert(int, @numericlsn)
return convert(binary(4), @high4bytelsncomponent) +
convert(binary(4), @mid4bytelsncomponent) +
convert(binary(2), @low2bytelsncomponent)
END
Replication--将LSN转换成16进制的更多相关文章
- Linux c字符串中不可打印字符转换成16进制
本文由 www.169it.com 搜集整理 如果一个C字符串中同时包含可打印和不可打印的字符,如果想将这个字符串写入文件,同时方便打开文件查看或者在控制台中打印出来不会出现乱码,那么可以将字符串中的 ...
- ip地址转换成16进制long
<span style="font-size:18px;">public class IpUtil { /** * ip地址转换成16进制long * @param i ...
- java中将汉字转换成16进制
技术交流群:233513714 /** * 将汉字转换车16进制字符串 * @param str * @return st */ public static String enUnicode(Stri ...
- 运用C语言将图片转换成16进制的字符串(base64)
最近在写手机端的性能测试脚本的时候,发现手机在上传图片数据时,先将图片转换成一堆16进制的字符,将字符传输过去,服务器再将字符解码成图片 我们在loadrunner中测试时,就需要用C语言将图片编码. ...
- C#把汉字转换成16进制(HEX)并向串口发送数据
报警器实例:(有发送,无返回获取) using System; using System.Collections.Generic; using System.Linq; using System.Te ...
- rgb值转换成16进制
由于jQuery获取css中的background有时候是rgb值,所以往往需要一个转换函数. 以前觉得难,还写个博客记录,现在觉得好容易. let testColor = "rgb(20, ...
- js方法实现rgb颜色转换成16进制格式的代码的方法
原文地址:http://www.cnblogs.com/vaal-water/archive/2013/04/08/3008880.html 自己试过很好用 function zero_fill_he ...
- java-pfx文件转换成16进制内容
public static void main(String[] args) throws Exception { String path = "D://111.pfx"; Inp ...
- 本大神教你用PHP把文本内容转换成16进制数字,进行加密
<?php $a="杨波"; $b = bin2hex($a); echo $a."<br />"; $c = pack("H*&q ...
随机推荐
- 汇编调用C程序
本程序用keil5实现. keil4会将C程序的地址设为0x00000000,即一开始就运行C程序了,参数都还没设置好.这个错误我也没深究,因为我自己装的是keil5. 首先需要在汇编代码中给C程序指 ...
- js将秒转换为 分:秒 函数
/** * 将秒转换为 分:秒 * s int 秒数 */ function s_to_hs(s){ //计算分钟 //算法:将秒数除以60,然后下舍入,既得到分钟数 var h; h = Math. ...
- 【转】tcp_tw_recycle和tcp_timestamps导致connect失败问题
(2012-02-01 18:40:32) 近来线上陆续出现了一些connect失败的问题,经过分析试验,最终确认和proc参数tcp_tw_recycle/tcp_timestamps相关: ...
- Finite State Transducers
一, 简介 Finite State Transducers 简称 FST, 中文名:有穷状态转换器.在自然语言处理等领域有很大应用,其功能类似于字典的功能(STL 中的map,C# 中的Dictio ...
- Openssl rsa命令
一.简介 Rsa命令用于处理RSA密钥.格式转换和打印信息 二.语法 openssl rsa [-inform PEM|NET|DER] [-outform PEM|NET|DER] [-in fil ...
- 移动端flexbox的小tips
我也是看了腾讯isux的博客,解答了我关于flexbox一个很长时间的疑惑,就是flex布局在安卓手机会出现内容长短不同导致不均分的现象. 具体的内容可以去看腾讯isux的博客,地址在这:https: ...
- [C++] advanced reference
advanced reference
- Windows Server 2012 R2 Standard x64 deploy Visual Studio 2015 Application
When I run the Server application on Windows Server 2012 R2 operation system. I meet the error:MSVCP ...
- p4051 [JSOI2007]字符加密
传送门 分析 将字符串复制一遍然后直接求sa即可 代码 #include<iostream> #include<cstdio> #include<cstring> ...
- [SoapUI] SOAP UI-Groovy Useful Commands
Hi All, I have posted the SOAPUI and Groovy useful commands that may help you in your testing. Below ...