Search

Behavior changes of value() in SQL Server 2012 by carlop

Active

2
0
Sign in
to vote
Type: Bug
ID: 776560
Opened: 1/14/2013 11:00:08 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
The following query returns different results in SQL2008 and SQL2012:
declare @hexstring varchar(max) = NULL
select cast('' as xml).value('xs:hexBinary( substring(sql:variable("@hexstring"), 0) )', 'varbinary(max)')

in SQL2008 returns NULL
in SQL2012 returns 0x

In the changelog documentation there's no word about this
Details (expand)

Product Language

English

Version

SQL Server 2012 - Developer Edition

Category

XML Programmability

Operating System

Windows 7 Ultimate

Operating System Language

English

Steps to Reproduce

Just run the query using management studio:
declare @hexstring varchar(max) = NULL
select cast('' as xml).value('xs:hexBinary( substring(sql:variable("@hexstring"), 0) )', 'varbinary(max)')

Tested with SQL2012 with/without SP1 and SQL 2008 R2

Actual Results

in SQL2008 returns NULL
in SQL2012 returns 0x

Expected Results

NULL in both cases

Platform

X64

Virtualization

 
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.