How To Use Xml Data From A Sqlserver Table In A Gridview

Jan 6, 2008

I have a products table in a Sql Server 2005 database.  One of the fields contains the products attributes in xml.  The most commonly used attribute is color.  An element of color is inventory.  This is the only way I could think of to maintain inventory numbers of each color of each product using someone else's (opensource) code.  An example of an attribute field would be
<?xml version="1.0"?> <ArrayOfAttribute
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Attribute>
<Name>Color</Name> <Description>Shown in
Black</Description> <Selections> <AttributeSelection>
<FormattedValue>483 - Black</FormattedValue> <Value>483 -
Black</Value> <Inventory>25</Inventory>
</AttributeSelection> <AttributeSelection> <FormattedValue>484
- Lt. Tan</FormattedValue> <Value>484 - Lt. Tan</Value>
<Inventory>15</Inventory> </AttributeSelection>
<AttributeSelection> <FormattedValue>485 -
Pink</FormattedValue> <Value>485 - Pink</Value>
<Inventory>17</Inventory> </AttributeSelection>
</Selections> <SelectionType>SingleSelection</SelectionType>
</Attribute> </ArrayOfAttribute>

How can I read this into the gridview control so that it makes sense to the user?
Diane 

View 5 Replies


ADVERTISEMENT

How To Retreive Data From Excel Into SQLSERVER Database Table

Oct 6, 2007

Hi friends,
I need to retreive data from Excel into SQLSERVER database table
give me reply asap.
Thanks in advance...

View 4 Replies View Related

Check Data Availbility Between Two Table In Sqlserver 2005 Using C#

Dec 13, 2007

I have Two table.One is MainTable and other is Temporary table.Both have Same Field
Before entering data into main table I want to check weather these data's are already there or not.
Here i am checking only three column of temporary table to the MainTable.

View 2 Replies View Related

HELP,,Imports A Data From Excel File Into A Table In SQLserver Database

May 6, 2008

Dear all,,
I need your help,,I'm work in website project using ASP.NET,,I have to register the users of this site,, the users are over 200,,so,,I'm thinking in away to save my time,,All the information of these users are stored in Excel file,,What I want to do is to imports these data from the excel file into a table in my database(SQLserver database),,Could you help in coding by VB.NETThanks in advance,,

View 9 Replies View Related

Want Error Message To Appear When No Database Results Were Returned In GridView, Also Other GridView Issues.

Jun 12, 2008

Hi, I am seeking a hopefully easy solution to spit back an error message when a user receives no results from a SQL server db with no results. My code looks like this What is in bold is the relevant subroutine for this problem I'm having.   Partial Class collegedb_Default Inherits System.Web.UI.Page Protected Sub submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit.Click SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] WHERE [name] like '%" & textbox1.Text & "%'" SqlDataSource1.DataBind() If (SqlDataSource1 = System.DBNull) Then no_match.Text = "Your search returned no results, try looking manually." End If End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] ORDER BY [name]" SqlDataSource1.DataBind() End Sub Protected Sub reset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles reset.Click SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] ORDER BY [name]" SqlDataSource1.DataBind() End SubEnd Class  I'm probably doing this completely wrong, I'm a .net newb. Any help would be appreciated. Basically I have GridView spitting out info from a db upon Page Load, but i also have a search bar above that. The search function works, but when it returns nothing, I want an error message to be displayed. I have a label setup called "no_match" but I'm getting compiler errors. Also, next to the submit button, I also have another button (Protected sub reset) that I was hoping to be able to return all results back on the page, similar to if a user is just loading the page fresh. I'd think that my logic would be OK, by just repeating the source code from page_load, but that doens't work.The button just does nothing. One final question, unrelated. After I set this default.aspx page up, sorting by number on the bottom of gridview, ie. 1,2,3,4, etc, worked fine. But now that paging feature, as long with the sorting headers, don't work! I do notice on the status bar in the browser, that I receive an error that says, "error on page...and it referers to javascript:_doPostBack('GridView1, etc etc)...I have no clue why this happened. Any help would be appreciated, thanks! 

View 2 Replies View Related

Problem Unicode Data 0x2300 In SQLServer 2000 SQLServer 2005 Express

Sep 20, 2006

Hi experts;
I have a problem with unicode character 0x2300
I created this table
create table testunicode (Bez nchar(128))

Insert Data
insert into testunicode (Bez)values('Œ€„¢')
with 2 Unicode characters
Œ€ = 0x2300
„¢ = 0x2122

Selecting the data
select Bez from testunicode
I see
"?„¢"

„¢ = 0x2122 is ok but instead of 0x2300 there is 0x3f

When I modify the insert statement like that ( 8960 = 0x2300 )
insert into testunicode (Bez)values(NCHAR(8960)+'„¢')

and select again voila i see
"Œ€„¢"
Does anyone have an idea?

Thanks

View 1 Replies View Related

Retrieve Data From The Gridview

Jun 19, 2006

i need to retrieve data from a particular field of the gridview according to the selected row to stored it into session .....what i had done so far as following: Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)        DetailsView1.PageIndex = GridView1.SelectedIndex        Session.Add("receiverName", GridView1.??????)            End Sub????? is the part i am not sure what to code.... i tried different method by seems to have problem of convertion.

View 1 Replies View Related

Default Data Value In Gridview?

Jun 28, 2006

Hi, I am trying to set a default value for a date field in my update parameters:When I try an update with the DefaultValue="<% Now %>", I get this error:"String was not recognized as a valid DateTime."The updates work fine if no default value is set and it also works ok if I change the default value to a set string, such as "6/24/06".  I've tried using different data sources and datasets, but no luck.Anyone have any ideas on this?Thanks! <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:db1ConnectionString %>"
ProviderName="<%$ ConnectionStrings:db1ConnectionString.ProviderName %>" SelectCommand="SELECT [ID], [Name], [Date] FROM [Table1]" DeleteCommand="DELETE FROM [Table1] WHERE [ID] = ?" InsertCommand="INSERT INTO [Table1] ([ID], [Name], [Date]) VALUES (?, ?, ?)" UpdateCommand="UPDATE [Table1] SET [Name] = ?, [Date] = ? WHERE [ID] = ?">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Date" Type="DateTime" DefaultValue="<% Now() %>" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Date" Type="DateTime" />
</InsertParameters>
</asp:SqlDataSource>


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Date" HeaderText="Date" ReadOnly="true" SortExpression="Date" />
</Columns>
</asp:GridView> 

View 3 Replies View Related

Refreshing Data In GridView

Sep 18, 2006

Hi,I’m new to SQL Express, but I have created a table and a stored proc to populate it.I have dragged the table into a form so I can view the data in a GridView.I have added a button to add new rows to the table. All the above works fine, except when I hit add, the data gets added, but the GridView doesn’t update and show the new data.  Is there some code I can add to the add button that also refreshed the GridView? ThanksMike

View 2 Replies View Related

Gridview && SQL Data Source

Jul 22, 2007

I have a few Stored procedures that return values, some need parameters passing and others don't.
Up to now to access that data in a Web App I have called this procedure using VB after seting up a data block etc.
However I notice that the Web Developer express edition has some tools that look like they should help. I have used the in-built tools to create a SQL data source linked to a details view.  I then specified that this should connect to my database (sql2005 hosted) and then specified Custom SQL or Stored procedure.
From the drop down I can then select the SP that purely returns values.   When I try to test this query I get an error to say that the query did not return any data tables.
Is there a way to get values returned from a SP in this way?
Regards
Clive

View 5 Replies View Related

Sql Data Dependency With GridView

Apr 3, 2008

 Hi,I want to add Sql  data dependency in GridView.  Whenever any changes in database, same will be reflected in Grid. but this should work in both Sql server 2000 and sql server 2005. And when we click on "Pause" button it should stop refreshing. 


 


 


 


PAUSE




Index


First name


Last Name


Address




1


Xyz


Abc


Asdf, asdf




2


Pqr


Asd


Sdsa, asad




 Is there any way to fulfill this kind of requirement? Please suggest me optimal solution to do this.Regards,Mustakim Mansuri 

View 1 Replies View Related

Why Could Not Databind The Gridview To The Aspnet_Users That Table.

Aug 11, 2007

I want to databind  the gridview to the  "aspnet_Users" that table  to view and edit the data, but when I configure the Datasource in the gridview, I could not find that table, the gridview only show the vw_aspnet_Users that view. I don't know what the problem is?
 
thanks
 

View 2 Replies View Related

Using A Temp Table And Variable With Gridview

Jun 16, 2008

Hi all, Im trying to use a temporary table along with a gridview.  But i keep getting an issue that says that I need to declare the variable name.  
 Right now, I have it set up that I have a permanent table in the database that is serving as my temporary table, however Im running into issues if multiple users access at once... So I would like to dynamically create a table and use that for my temporary table and then drop the table when the user is done with it...
 heres my code so far..Private Sub AddRecords(ByVal prodins As String, ByVal releaseins As String, ByVal opsysins As String, ByVal currelins As String, ByVal schemains As String, ByVal commentins As String, ByVal freeformins As String)
Dim tablevar As String = lblRequestor.TextDim tablename As String = "##" + tablevar Dim myConnection As New SqlClient.SqlConnection
Dim query As String = "CREATE TABLE " + tablename + "(UniqueID int Identity(1,1), Product varchar(50), OperatingSystem varchar(50), CurrentRelease varchar(50), Release varchar(50), SchemaSize varchar(50), Comments varchar(50), TempRelease varchar(50), FreeFormFlag varchar(50), sourcereleasedir varchar(125))"
Dim query2 As String = "INSERT INTO " + tablename + "(Product, Release, OperatingSystem, CurrentRelease, SchemaSize, Comments, TempRelease, FreeFormFlag) VALUES ('" & prodins & "','" & releaseins & "', '" & opsysins & "', '" & currelins & "', '" & schemains & "', '" & commentins & "', '" & currelins & "', '" & freeformins & "')"Dim myCommand As SqlClient.SqlCommandmyConnection = New SqlClient.SqlConnection("Data Source=mydatasource")
myConnection.Open()myCommand = New SqlClient.SqlCommand(query, myConnection)
myCommand.ExecuteNonQuery()myCommand = New SqlClient.SqlCommand(query2, myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()
 
And here is my query for the gridview....
 SelectCommand="SELECT * FROM @tablename where FreeFormFlag <> 'Y'"
and
<SelectParameters>
<asp:ControlParameter ControlID="tablename" Name="tablename" PropertyName="Text" DefaultValue="##default" />
</SelectParameters>
so @tablename is set to the value of a textbox i have hidden which the textbox gets the username of the user and adds ## to it..so if john doe comes on... the texbox reads ##jdoe... and thats what im trying to name the temp table.    SO the syntax is all there.... But i keep getting an error saying i need to declare @tablename... which is puzzling to me.. I tried doing
declare @tablename varchar (50)
select.....etc.  
 
but then it brings up an error saying... @tablename is already declared, each variable must be unique..., You must declare @tablename...   It tells me that its already declared then tells me i must declare it???  it makes no sense..
 
Anyone have any ideas?
Thanks,

View 4 Replies View Related

Multiple Data Controls In Gridview

Nov 28, 2007

one of my webpages uses the following sql query to allow the user to search through the database and present the qualifying data in gridview:
 SELECT * FROM [Table1] WHERE ([comments] LIKE '%' + ? + '%')
how could i expand this so that the user can also search through the database but instead by searching through another column such as [type]?
thanks in advance

View 11 Replies View Related

Display Data From A Database Without Using Gridview Etc.

Mar 19, 2008

I have a webform that I am wanting to display data from a database. Right now I am using the gridview but for future purposes when it comes to maintenance what would be the easiest way to do updates? For example, if I add a new record into the database I would like the webform to automatically update itself to show all the records including the new record I added. Do I need to use a "table" and somehow connect it to a database? Do any stored procedures need to be created? Suggestions/ideas/codes help help help would be verrrry much appreciated!!! Also I am using MS Server 2003 and C# as the programming language. Thank you!!!!

View 9 Replies View Related

Changing Format Of Data In Gridview Using VB

Mar 24, 2008

Hello all,
I am trying to modify the output of a SELECT statement in a VB asp.net page that pulls data from a SQL DB. I only need to modify one column in the gridview, but I'm having some issues.
Here is the situation:SELECT     TOP 24 ID, RecID, Timestamp, Answered, Holds, Dropped, Waits, Voicemail, Busied, LiveWaitsFROM         mTrafficORDER BY Timestamp DESC
The Timestamp column returns a number value (i.e. 564566).In terms of a date, 564566 doesn't mean anything to the user, so I need to convert this number into a recognizable and accurate date.
The formula I need to implement is Timestamp/1440 - 1
The following SELECT statement returns the number as a date, but makes all records the same date:
SELECT     TOP 24 ID, RecID, Convert(datetime, Timestamp/1440 + 1) as Timestamp, Answered, Holds, Dropped, Waits, Voicemail, Busied, LiveWaitsFROM         mTrafficORDER BY Timestamp DESC
What do I need to do to implement this function dynamically into my gridview?
Thanks in advance!
 
Chris

View 2 Replies View Related

Display Data In A Gridview In A Little Diiferent Way

Apr 25, 2008

Good Day, Please help me, I have a database that looks like this, Building No.        Floor No.        Room No.        Customer Name            Appliances          Appliances Codea                        1                    01                    John                            TV                    12a                        1                    02                             //up tob                        20                  10                    james                       Ref.                       22b                        20                  10                    joe                           Microwave             15 //and soon so if you would notice some rooms are vacant, as it usually happens, the buildings, floors and rooms are fixed except for the customers and the appliances. so at first i made this gridview and display this data in this manner:Customer Location (Building + floor)           total rooms         Used Rooms         Available rooms       A1                                                             2                  1                              1       B2010                                                        2                  2                              0 so if you would look at the table above, it just SUM up all tenants in a specific Location then Group it by Customer location,but i need to add the appliances in a different format like this: Customer Location (Building + floor)           total rooms         Used Rooms         Available rooms            TV         Ref            Microwave
       A1                                                       
     2                  1                              1                         tick
       B2010                                                  
     2                  2                              0                                       tick               tick so this is what i need to show, i already have done the first table (w'o appliances) but how can i make this second table?? please help me, SALAMAT PO.,Thanks  

View 3 Replies View Related

Filter Data And Update GridView

May 11, 2008

I have a GridView that gets data from an SqlDataSource. It works fine, but now when I want to filter the results and add more parameters to my sql query, nothing happens. My initial select statement in the SqlDataSource contains only 2 parameters, so now when a user clicks a Button, onclick I call a function that is supposed to change the select statement of the SqlDataSource, add 2 more parameters taken from 2 controls, and then update the GridView. This is what I use: dataSource.SelectCommand = "new select command here";  dataSource.SelectParameters.Add("State", txtState.Text); dataSource.SelectParameters.Add("City", txtCity.Text);  grid.DataBind(); It compiles, but when I click the button to filter the results, the GridView always looks the same as if nothing happened. I do not know if this is the right way to do it, or am I on the wrong track? Help is appreciated. Thank you in advance.

View 2 Replies View Related

Delete Data From GridView And ObjectDataSource

Mar 11, 2006

The function that is supposed to delete a row, is not working. The function is called, and the windows is refreshed, but the row is not deleted.Can anyone see anything wrong with this code:public static void DeleteBlog(int original_BlogID) { string insertCommand = "DELETE FROM Blog WHERE BlogID = @BlogID"; SqlConnection myConnection = new SqlConnection(Blog.ConnectionString); SqlCommand command = new SqlCommand(insertCommand, myConnection); command.Parameters.Add(new SqlParameter("@BlogID", original_BlogID)); myConnection.Open(); command.ExecuteNonQuery(); myConnection.Close();}

View 3 Replies View Related

Display A Table From A Gridview But Every Column Has Its Own Where Arguments??

Mar 10, 2008

Hi,please help me, i have a data driven site,i need to display a table who look like this Name            Total            Used            RemainingA                    10                5                    5B                    20                13                  7C                    12                                    12  if you would look on the field of total, used and remaining, they look like an excel formula which is total - used = remaining or vise versa.but the problem in this table is the database, it look like thisname         On/OffA                  1A                   1A                    0and soon....... B                     1B                     0B                     1and soon.... until C so how do i count the total, is the number of A's or B's or C's in the whole database then Group By the 'name' fieldthen how do i count the used is the number of ON in the On/Off field while remaining is counting the Off,so my question is i have RUN this using 3 different gridview each has its own datasource, that look like this for the used  select name, count(on/off)
from myTable
where on/off = 1
group by name for the  remaining select name, count(on/off)
from myTable
where on/off = 0
group by name and for the total, just used the same Select but without the where clause,i get this problem when the field "used"  (please refer from the 1st table) it has a blank value, which is because my data base show that in deed name "C" has not been used, but eve though it should show '0' instead of a blank,  so how can i do that???please help me, thanks 

View 6 Replies View Related

Why Can't I Enable Editing On A Gridview That Gets It's Data From A View Through An SqlDataSource?

Nov 22, 2007

Hi,
I think the title explains it all really. I cannot configure the SqlDataSource to add Insert, Update and Delete statements - not through the wizard anyway.
The view combines two tables, each containing 3 columns. I have tried using different combinations of columns, and ended up selecting all of them (making sure the foreign key column of the first table was given a different alias to the primary key column of the second table) but I still cannot enable editing.
Cheers,
Patrick

View 3 Replies View Related

Error Editing Data Records In Gridview When Using Convert Function.

Jan 24, 2008

Hello, i currently have a gridview that is populated with data from a SQLServer datasource. I have put an output mask in the select statement, so the date and time attributes are displayed in the format i prefer them to be in. SELECT PatientNo, ConsultantName, HospitalName, CONVERT (varchar, Date, 101), CONVERT (varchar, Time, 8) FROM [Appointment];
 However when i click the 'edit' link for a record in the gridview, i am unable to edit the date/time attributes and when i click update to confirm any changes to the other attributes, the values in the date/time attributes are emptied. How can i solve this update problem. I'm guessing i need to configure my SQL UPDATE statement, but bit stuck how i do this. Please help!
Thanks,
James

View 9 Replies View Related

Stored Procedure To Display The Relevant Data Of The IDs In The Database To A Gridview

Mar 7, 2008

Here is the Stored procedure 
ALTER procedure [dbo].[ActAuditInfo](@IndustryName nvarchar(50) output,@CompanyName nvarchar(50) output,@PlantName nvarchar(50) output,@GroupName nvarchar(50) output,@UserName nvarchar(50) output
)asbegindeclare @AuidtID as varchar(30)Select @IndustryName=Industry_Name from Industry whereIndustry.Ind_Id_PK =(Select Audit_Industry from Audits whereAd_ID_PK=@AuidtID)Select @CompanyName=Company_Name from Company whereCompany.Cmp_ID_PK =(Select Audit_Company from Audits whereAd_ID_PK=@AuidtID)Select @PlantName=Plant_Name from Plant where Plant.Pl_ID_PK=(Select Audit_Plant from Audits where Ad_ID_PK=@AuidtID)Select @GroupName=Groups_Name from Groups whereGroups.G_ID_PK =(Select Audit_Group from Audits whereAd_ID_PK=@AuidtID)Select @UserName=Login_Uname from RegistrationDetails whereRegistrationDetails.UID_PK =(Select Audit_Created_By fromAudits where Ad_ID_PK=@AuidtID)SELECT Ad_ID_PK, Audit_Name, @IndustryName, @CompanyName, @PlantName,@GroupName, Audit_Started_On, Audit_Scheduledto, @UserName FROMAudits where Audit_Status='Active'end
U can see here different parameters,my requirement is that iam havingID's of Industry,company,plant,group,username stored in a table calledPcra_Audits and i must display their related names in the front end.so this is the query iam using for that.
Data in the database:Commercial83312 2       2       2       1       1       InactiveHere u can see  2,2,2,1,1 these are the IDs ofindustry,company,plant,group and username and Commercial83312 is tehaudit ID.now i want to display this data in teh front end as i cannot displaythe IDs i am retrieving the names of the particular IDs from therelated tables.Like iam getting name of the IndustryID from Industry Table,in thesame way others too.when iam running this procedure iam getting the gridview blank.iam passing the output parameters:@IndustryName nvarchar(50) output,@CompanyName nvarchar(50) output,@PlantName nvarchar(50) output,@GroupName nvarchar(50) output,@UserName nvarchar(50) outputinto the function in the frontend and iam calling that into the pageload method.please help me with this.

View 1 Replies View Related

Gridview - Updating Is Not Supported By Data Source 'SqlDataSourceGridView' Unless UpdateCommand Is Specified

May 13, 2008

 Hi all,I have a gridview that bound to a SqlDataSource called SqlDataSourceGridView. I have enabled Edit in my GridView, but I do all the updating in code behind with stored procedure (using onRowUpdating). Now each time when I click "Update", the update went through and all the data got updated, but I received this error: Updating is not supported by data source 'SqlDataSourceGridView' unless UpdateCommand is specified.



Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.NotSupportedException:
Updating is not supported by data source 'SqlDataSourceGridView' unless
UpdateCommand is specified. What do I need to do to fix this problem?Thanks a lot. 

View 6 Replies View Related

Stored Procedure When Calling From Front End Not Displaying Any Data In The Gridview.

Feb 22, 2008

Hi

i have a search page having four text boxes like name,accountnumber,ssn..etc we have to search the database by these values. but even if we give value in one text box keeping the others null the stored procedure have to serach and get the values. and we display it using gridview control.

here is the stored procedure i wrote.but its not working.its not giving any erros...but its not showing any values.




ALTER Procedure [dbo].[usp_CheckUser]

@name nvarchar(50),
@ssn nvarchar(50),
@accountnumber nvarchar(50)

AS
BEGIN
if(@name!=null AND @ssn!=null AND @accountnumber!=null)
select * from Userinfo where name=@name AND ssn=@ssn AND accountnumber=@accountnumber
else if(@name=null AND @ssn!=null AND @accountnumber!=null)
select * from Userinfo where ssn=@ssn AND accountnumber=@accountnumber
else if(@name=null AND @ssn=null AND @accountnumber!=null)
select * from Userinfo where accountnumber=@accountnumber
else if(@name!=null AND @ssn=null AND @accountnumber!=null)
select * from Userinfo where accountnumber=@accountnumber AND name=@name
else if(@name!=null AND @ssn=null AND @accountnumber=null)
select * from Userinfo where name=@name
else if(@name!=null AND @ssn!=null AND @accountnumber=null)
select * from Userinfo where name=@name AND ssn=@ssn
else if(@name=null AND @ssn!=null AND @accountnumber=null)
select * from Userinfo where ssn=@ssn

end


table name is userinfo


please help me with this. its very urgent.
thanx for your help in advance.

ramya

View 7 Replies View Related

How To Transfer Data From A SqlServer Database To A SqlServer Express Database

Mar 29, 2006

Is there a way to transfer data from a SqlServer db to a SqlServer Express db. I tried to use the backup file of SqlServer, but this file is not valid for SqlServer Express. Or there any alternatives?

thanks,

Henk

View 7 Replies View Related

SqlServer 2005 String Or Binary Data Would Be Truncated When Data Is OK

Feb 21, 2006

When using AquaData or JDBC (inet tds driver), when doing an insert using SqlServer 2005, I get error "String or binary data would be truncated" when the data is actually OK. There are no triggers, etc. that would confuse the situation. It works fine in SqlServer 2000.

The scenario is as follows:

Create table:
create table test3 (
name varchar (18) ,
tbname varchar (18)
)

Create and populate table:
create table maxtable (
tablename varchar (18) not null,
[...]
)

Try to insert into test3:
insert into test3 (name, tbname)
select i.name, o.name
from dbo.sysindexes i, sysobjects o, maxtable m
where i.indid > 0 and i.indid < 255
and i.id = o.id and i.indid = 1
and o.name = lower(m.tablename)

And I get the error "String or binary data would be truncated." The values being selected for i.name and o.name have maximum length of 18. There are other rows in sysindexes and sysobjects with longer values, but they are not being selected.

The error does not occur with SQL Server Management Studio, and does not occur using SqlServer 2000.

View 6 Replies View Related

&&<Data&&>Microsoft.SqlServer.Dts.Pipeline.BlobColumn&&</Data&&>

Feb 26, 2008



I have a custom (dataset) destination component from ms samples and it has an input holds DT_NTEXT value.

Whenever I try to retrieve data from this it returns "Microsoft.SqlServer.Dts.Pipeline.BlobColumn" as value.

I try this but didn't work:


String sValue = System.Text.Encoding.Default.GetString(Convert.FromBase64String(this.dataSet.Tables[0].Rows["Data"].ToString()));


It throws an execption "invalid character in.."

Please help how I can convert this?

Thanks in advance

View 6 Replies View Related

Joining MS SqlServer Data With Oracle Data

Nov 7, 2007

OK so there is some data in an Oracle DB that I need to query and analyze.  Unfortunately, the criteria for selecting/grouping the data is stored in a MS Sql Server DB.  This cannot be changed. 
SqlServerGroup Name       ID#      Item     ConditionAAA123              1         a              1AAA123              2         a              1AAA123              3         a              1AAA123              4         a              2AAA123              5         a              2AAA123              1         b              3AAA123              2         b              4AAA123              3         b              3AAA123              4         b              4AAA123              5         b              3BBB123              1         a              1BBB123              2         a              1BBB123              3         a              2BBB123              4         a              2BBB123              5         a              2
OracleGroup Name       ID#     ValueAAA123              1          50%AAA123              2          55%AAA123              3          60%AAA123              4          80%AAA123              5          70%BBB123              1          35%BBB123              2          45%BBB123              3          50%BBB123              4          50%BBB123              5          80%
 I need to be able to get this:Group Name  Item   Condition ValueAAA123          a           1          55%AAA123          a           2          75%AAA123          b           3          60%AAA123          b           4          67.5%BBB123          a           1          40%BBB123          a           2          60%
 Any idea how I can get the data from these two DBs to talk to each other?  Thanks.

View 6 Replies View Related

How To Look All The Table In A Database In Sqlserver

Feb 27, 2001

how to look all the table in a database in sqlserver,
and what are the maintanance jobs that needed to be run either daily or weekly.

K

View 1 Replies View Related

SQLServer Table Partitioning

Jun 5, 2007

Hi!I have a question:I already have a DB that uses partitions to divide data in USCounties, partitioned by state.Can I use TWO levels of partitioning?I mean... 3077 filegroups and 50 partition functions that addressthem, but can I use another function to group the 50 states?Thanks!Piero

View 15 Replies View Related

Help With Getting Table Information From Sqlserver

Jul 20, 2005

I am new to using sqlserver and have been given the task to get the columnname, data type and the description from a given table and put this intoanother table. Can this be done?Thanks in advance.Jeff Magouirk

View 2 Replies View Related

Asp.Net And SqlServer Data

Oct 19, 2004

Hi

can anybody tell me that:
1)How can i retrieve a binary field (image field) that stored in SqlServer2000 with Vb.Net and save
it again in my hard disk that i have again that file?
2)can SqlServer itself convert image field to file with its store procedures?
3)can sqlserver run an exe file on local computer from its storeprocedure?

Best Regards

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved