Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

string or binary data would be truncated

Posted on 2006-11-13
3
Medium Priority
?
729 Views
Last Modified: 2012-06-22
Hi,
 
   I am working on another source file. i am getting an error in the following method at this line.
 
 
MyAdapter.Fill(EmailList)

Error message:string or binary data would be truncated . The statement has been terminated.


 
Sub EmailNameList()

Dim cmd As New SqlCommand("usp_select_alarm_email_list", Conn)

cmd.CommandType = CommandType.StoredProcedure

Dim AlarmIdParm As SqlParameter = cmd.Parameters.Add("@AlarmId", SqlDbType.Int)

AlarmIdParm.Value = AlarmId

Dim EmailList As DataSet = New DataSet

Dim MyAdapter As New SqlDataAdapter()

MyAdapter.SelectCommand = cmd

MyAdapter.Fill(EmailList)

emailGridView.DataSource = EmailList

emailGridView.DataBind()

End Sub

I can post  the stored procedure as well.Please look in to that , but i can execute the stored procedure.
 
 
 
 
ALTER procedure [dbo].[usp_select_alarm_email_list] (@AlarmId int) as

declare @email_list table

(

email_id int,

description varchar(250),

email_type char(1)

)

insert into @email_list (email_id, description, email_type)

select

email_id, description, 'P'

from

email_address_book

insert into @email_list (email_id, description, email_type)

select

distribution_list_id, description, 'L'

from

distribution_list

select

t.email_id,

t.description,

email_type =

case

when t.email_type = 'L' then 'Distribution'

when t.email_type = 'P' then 'Individual'

else 'Unknown'

end ,

selected =

CASE

WHEN a.id is NULL THEN 0

ELSE 1

END

from

@email_list t

left outer join alarm_email_relation a (NOLOCK)

on t.email_id = a.id and

t.email_type = a.email_type and

a.alarm_id = @AlarmId

 
Thanks,
 
Sreekanth Nagabandi,
0
Comment
Question by:Sreekanth_Nagabandi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
Kinger247 earned 2000 total points
ID: 17932441
Looks like your trying to insert data that is to large for the table column.
0
 
LVL 6

Expert Comment

by:riyazthad
ID: 17932451
Its look like you are not returning anything from sp.

put last line as

select * from @email_list
0
 
LVL 10

Expert Comment

by:ibost
ID: 17933010
Look at the base tables:
email_address_book and distribution_list

The problem is in one of those tables, the column for "description" is bigger than varchar(250).

When you declare the table variable here:
declare @email_list table

(

email_id int,

description varchar(250),

email_type char(1)

)

Make sure you allow the "description" column to be at least as big as the biggest "description" column in the base tables.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question