SQL Query Returns System.Byte[] error for field

Hello,

When I try to run my SQL query in Nintex I get the system.byte error for the "EventLongDescritpion" field.  The field is a Varbinary field and has a character maximum length of -1.

Here is my connection string:

Data Source=*******;Initial Catalog=AccidentsAndIncidents;Persist Security Info=True;User ID=*****;Password=*******

Select statement:

Select Closed, EventTimestamp, BaseLocationName, IncidentNumber, Incident_PK, ReportingPersonName, EventDescriptionlong, Eventtypes
From IncidentView
Where Closed = 'false' AND GETDATE() > dateadd(dd,30, eventtimestamp) AND WorldWideUnit = 'NAIG USA'


Any help would be greatly appreciated!!
rathfam4Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

plusone3055Commented:
id change the type in that table from byte to varchar(max) just too see if that solves the issue
let us know if that solves it

if it does fix it
determine what the max should be obviously byte is too short for the characters in that field
0
rathfam4Author Commented:
Thanks for your response!

Not sure If I have that ability I will have to check with my IT dept.  Can it be fixed in by connection string or select statement?
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I would do the some.
other than that, you would have to convert the binary array into some text, for example if the encoding is UTF8:
string yourtext = Encoding.UTF8.GetString( yourByteArray );
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

plusone3055Commented:
I do not belive the connection string has anything to do with it..
if you have access to SQL server management stuido you can change it very easily
1.click the + sign next to the database
2. click the+ sign on table folder
3. right click the table in question and choose design
4. change the datatype with the dropdown from byte to varchar
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the some => the same
0
plusone3055Commented:
a simple query to do this would be

alter table  table1 alter column EventDescriptionlong VARCHAR(200)

to change it back

alter table  table1 alter column EventDescriptionlong byte
0
rathfam4Author Commented:
Thanks all for your responses.  I will check tomorrow to see if it works.
0
XGISCommented:
Hello Everyone,

Another option if access to the database instance is not available would be to convert the varbinary to nvarchar with formatting  (if the string is a hexidecimal).

give this a shot if you cant gain access to the database via ssms

CONVERT(NVARCHAR(max), EventDescriptionlong, 1) AS EventDescriptionlong

Open in new window


it can be used in a T-SQL query.

for more information about CONVERT and styles
http://technet.microsoft.com/en-us/library/ms187928.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.