Conversion Fails. Please Analyze Error Msg.

Nov 26, 2006

Msg 245, Level 16, State 1, Procedure CompactL1RecordsFromfirstINTRAD, Line 177
Conversion failed when converting the varchar value
'DECLARE rows_cursor CURSOR FOR
SELECT ask, dateTimed FROM iDay_Compr_GOOG
WHERE DAY (dateTimed) = ' to data type int.


I get this message while executing a stored procedure. It works "half way" but skips this statement and the whole block as a result. In the table @table_name ask is declared as float and dateTimed as DateTime. Similar statements work happily in other stored procedures with no problem. Even in the same stored procedure I have places where I use DAY (dateTimed) and they seem to work as far as I can see although it is a very branched out code with many IF ... ELSE's.

SET @SQL = 'DECLARE rows_cursor CURSOR FOR
SELECT ask, dateTimed FROM '+@table_name+'
WHERE DAY (dateTimed) = '+@day+' AND NOT ask = 0'
exec sp_sqlexec @SQL
OPEN rows_cursor
FETCH LAST FROM rows_cursor INTO @askQ, @lastTableDateTime
SET @SQL = 'UPDATE '+@table_name+' SET askSize = askSize + '+@askSize+'
WHERE dateTimed = '+@lastTableDateTime+' AND ask = '+@askQ
exec sp_sqlexec @SQL -- <== this is line 177
CLOSE rows_cursor
DEALLOCATE rows_cursor

Another puzzle for me is the line number. I used Edit-->GO TO--> 177 to single the line out and it seems to point to a different exec sp_execsql @SQL statement, the one that is down the road.

I can make neither head nor tail out of it. I am sure Jens, Cetin or Andrea or whoever stumble on this post will be able to figure this out. Anyone else's help will also be appreciated.

Many thanks.

View 15 Replies


ADVERTISEMENT

Unwanted Conversion Fails Sorting Code

Jan 13, 2005

I have some code that sorts a column logically even if it contains both numbers and text. But I've found that SQL converts certain characters automatically....

Here is the code...

SELECT * FROM TABLE

order by
case when isnumeric(fieldname)=1 then
right(replicate(' ', 10 ) + convert(varchar,convert(numeric(10),fieldname)),10)
else fieldnameend --10 is the length of the field


The issue I've run across is that if my column contains the following strings(5D000,5E000,4E001) it thinks they are numeric then the THEN part of the condition causes a typecasting error....

I found out that any certain combinations of number + E or D + 0. Does anyone know a way to get around this? Try it out select isnumeric('5E0303') will return 1

View 1 Replies View Related

Month ('jan','feb',...) String To Date Conversion Fails

Oct 2, 2006

I use the derived column to convert a string date from a flat file like this: "Jan 02 2005" into a datetime.
I have seen in the forum to use: (DT_DATE)(SUBSTRING(mydate,5,2) + "-" + SUBSTRING(mydate,1,3) + "-" + SUBSTRING(mydate,8,4))
However, even if it produces a string like '02-Jan-2005', the following cast to dt_date fails.
I have also tried inverting month and day, year/month/day but all with the same result:

Derived Column [73]]
Error: The component "Derived Column" failed because error code
0xC0049064 occurred, and the error row disposition on "output column"...

I think the cast fails bacause of the month format. Therefore the only solution would be to code in in a lookup table Jan, 01 | Feb, 02 |... ????

View 5 Replies View Related

DB Analyze

Mar 16, 2008

I have been asked to analyze a DB which was under a different team. I have done the following,

1.Identified tables without PK, and clustered index
2.identified FK’s without index
3.orphan users and weak passwords
4.analyzed SPS for bad code

Is there anything else I can do? Are there any ready-made scripts which I can use.


------------------------
I think, therefore I am - Rene Descartes

View 5 Replies View Related

Analyze Index In Ms SQL

Jul 21, 2003

Hello, friends!
sorry for the stupid question:
I created a new index on table and I'm looking to a command equal to "Analyze table ", "Compute statistics "in Oracle
to check if that index is usefull.

Thank you very much in advance.

View 3 Replies View Related

Flat File Source Error Output Conversion Error With UNICODE Files

May 14, 2008

i have a weird situation here, i tried to load a unicode file with a flat file source component, one of file lines has data like any other line but also contains the character "ÿ" which i can't see or find it and replace it with empty string, the source component parses the line correctly but if there is a data type error in this line, the error output for that line gives me this character "ÿ" instead of the original line.


simply, the error output of flat file source component fail to get the original line when the line contains hidden "ÿ".

i hope you can help me with issue.

Thanks in advance.

View 5 Replies View Related

Analyze Key Influencers Questions

Jun 24, 2007

I will be grateful if you could answer a few more questions around Analyzing Key Influencers



1. When specifying the training data for Decision Tree, there is a SUGGEST button (Recommend inputs for currently set predictable) which recommends which input are related to the predictable attribute. It also gives a €˜Score€™ for each recommended inputs. What algorithm does the SUGGEST button use? Does it use simple entropy/correlation based algorithm OR sophisticated feature selection algorithms?

2. Can I access this €˜Score€™ and recommended inputs above programmatically?

3. What feature selection algorithms are used in SQL Server 2005? Can they be invoked programmatically?

5. In Logistic Regression mining model viewer, we get a chart which clearly shows what attributes favor which state of the predictable attribute. For example, income level < 23000 favors BikeBuyer = 0 (does not buy) with a score of 89.00. What algorithm is used to calculate the €˜Score€™? Can LR be used as a feature selector in case where the predicted attribute is binary (select the attributes that favor one state or the other with a score of, say, greater than some threshold)?

6. You suggested using Naive Bayes to find AKIs. What if the input attributes are all continuous (predicted attribute binary)? Shouldnt I be going for LR?

Thanks bunches

MA

View 4 Replies View Related

Analyze Key Influencers Issue........

Oct 23, 2007

Excuse the elementary question; I am new to this feature.


No matter what dataset I use, I get the following error:
"The task was not able to detect any key influencers for the 'xxx' column. The values of 'xxx' seem unrelated to values of other columns."


Any ideas on what is happening here?

Here is the sample dataset:







Loan Amount
CLTV
transmitted

1,000
51.0%
1

5,000
52.0%
1

9,000
53.0%
1

13,000
54.0%
1

17,000
55.0%
1

21,000
56.0%
1

25,000
57.0%
1

29,000
58.0%
1

33,000
59.0%
1

37,000
60.0%
0

41,000
61.0%
0

45,000
62.0%
0

49,000
63.0%
0

53,000
64.0%
0

57,000
65.0%
0

61,000
66.0%
0

65,000
67.0%
0

69,000
68.0%
0

73,000
69.0%
0

77,000
70.0%
0

Thanks in advance.......

View 13 Replies View Related

Why Am I Getting An Error Runtime Error Conversion String Type Pr_h_reqby To Int

Jan 17, 2007

here is my code the falue of pr_h_reqby is "Test" 
Dim strconn As New SqlConnection(connstring)
Dim myReqdata As New DataSet
Dim mycommand As SqlDataAdapter
Dim sqlstr As String = "select pr_H_reqby from tbl_pr_header where pr_h_recid = " & recid & ""
mycommand = New SqlDataAdapter(sqlstr, strconn)
mycommand.Fill(myReqdata, "mydata")
If myReqdata.Tables(0).Rows.Count > 0 Then
'lblReqID.Text = myReqdata.Tables(0).Rows("reqid").ToString
lblNameVal.Text = myReqdata.Tables("mydata").Rows("pr_H_reqby").ToString()
lblEmailVal.Text = myReqdata.Tables("mydata").Rows("pr_h_reqemail").ToString()
lblReqDateVal.Text = myReqdata.Tables("mydata").Rows("pr_h_reqdate").ToString()
lblneedval.Text = myReqdata.Tables("mydata").Rows("pr_h_needdt").ToString()
lblDeptval.Text = myReqdata.Tables("mydata").Rows("pr_h_dept").ToString()
txtbxReqDesc.Text = myReqdata.Tables("mydata").Rows("pr_h_projdesc").ToString()
End If

View 1 Replies View Related

Oracle's Analyze Table Statement ?

Oct 9, 2004

Hi,

Below is an Oracle query used for cost optimization purpose :

analyze table test estimate statistics sample 2500 Rows;

Is there any equivalent for the above in SQL Server ?

Please advice,

Thanks,
Sam

View 5 Replies View Related

Dbcc Showcontig Results...analyze Please

May 21, 2008

Dear All,
i've used the DBCC showcontig command against my table table103
but i dont know how to analyze the results of fragmentation levels. please give me some explanations or some good links.....

the results are:
DBCC SHOWCONTIG scanning 'TABLE103' table...
Table: 'TABLE103' (1899257921); index ID: 1, database ID: 10
TABLE level scan performed.
- Pages Scanned................................: 20
- Extents Scanned..............................: 13
- Extent Switches..............................: 18
- Avg. Pages per Extent........................: 1.5
- Scan Density [Best Count:Actual Count].......: 15.79% [3:19]
- Logical Scan Fragmentation ..................: 90.00%
- Extent Scan Fragmentation ...................: 92.31%
- Avg. Bytes Free per Page.....................: 3281.4
- Avg. Page Density (full).....................: 59.46%

Vinod
Even you learn 1%, Learn it with 100% confidence.

View 10 Replies View Related

Analyze LDF Files MS SQL Server 2000

Jul 20, 2005

Anybody nows a tool to analyze LDF files in MS SQL Server 2000?I mean, a tool that converts a LDF file in a set of SQL transactions?(similar to dbtran in sybase)thanks!

View 3 Replies View Related

How To Analyze Slow Performance Queries

Feb 27, 2008



Hi All

I struck up with Slow perfornace query,Please some body help me how to analyze Slow perforamnce queris.

View 6 Replies View Related

Analyze Backup And Restore Rows

Nov 23, 2006

Hi, the other day, some data was deleted by mistake, the data that we wanted to delete was in just 1 table, and we deleted the related data in a couple tables more...

We do full backups every Sunday and a Differential every day, my question is:

Is there any way to analyze the backup file to compare the backed up data with the data that the table has now, and by automatic means restore just some rows to the table, or at least see the data to insert it manually?

Thanks!

View 5 Replies View Related

How Can I Query Analyze DB Greater Than 128MG

Jun 25, 2007

I have a 300MG DB and Query Analyzer gives me the "... DB larger than configured..." error when I try to connect to it...



What is the work around?



Thanks in advance



JEK

View 5 Replies View Related

Analyze / Data Mining Ribbons

May 29, 2007

I have installed SP2 on my laptop and I have installed the latest Data Mining Add-Ins.



When I open the sample spreadsheet and select the table in a worksheet called "Table Analysis Tools Sample", I dont get Analyze ribbon under Table Tools. Is ther any reson for it?



I dont get Data Mining option either! Is there something I have to do before getting those menus to appear in the ribbon?



I have been through "Getting Started" and set the AS connection to the local AS Server.



Thanks

Sutha

View 17 Replies View Related

Script To Analyze Table Space Usage

Feb 14, 2006

Edit 2007-8-9:
Added code to show database file sizes. Not really closely related to tables sizes, but a lot of the people who need this want to know why their database it so large, so it may help to know which files, especially the logs, are so large, and if the files have empty space in them.


-- Script to analyze table space usage using the
-- output from the sp_spaceused stored procedure
-- Works with SQL 7.0, 2000, and 2005

set nocount on


print 'Show Size, Space Used, Unused Space, Type, and Name of all database files'

select
[FileSizeMB]=
convert(numeric(10,2),sum(round(a.size/128.,2))),
[UsedSpaceMB]=
convert(numeric(10,2),sum(round(fileproperty( a.name,'SpaceUsed')/128.,2))) ,
[UnusedSpaceMB]=
convert(numeric(10,2),sum(round((a.size-fileproperty( a.name,'SpaceUsed'))/128.,2))) ,
[Type] =
case when a.groupid is null then '' when a.groupid = 0 then 'Log' else 'Data' end,
[DBFileName]= isnull(a.name,'*** Total for all files ***')
from
sysfiles a
group by
groupid,
a.name
with rollup
having
a.groupid is null or
a.name is not null
order by
case when a.groupid is null then 99 when a.groupid = 0 then 0 else 1 end,
a.groupid,
case when a.name is null then 99 else 0 end,
a.name




create table #TABLE_SPACE_WORK
(
TABLE_NAME sysnamenot null ,
TABLE_ROWS numeric(18,0)not null ,
RESERVED varchar(50) not null ,
DATA varchar(50) not null ,
INDEX_SIZE varchar(50) not null ,
UNUSED varchar(50) not null ,
)

create table #TABLE_SPACE_USED
(
Seqintnot null
identity(1,1)primary key clustered,
TABLE_NAME sysnamenot null ,
TABLE_ROWS numeric(18,0)not null ,
RESERVED varchar(50) not null ,
DATA varchar(50) not null ,
INDEX_SIZE varchar(50) not null ,
UNUSED varchar(50) not null ,
)

create table #TABLE_SPACE
(
Seqintnot null
identity(1,1)primary key clustered,
TABLE_NAME SYSNAME not null ,
TABLE_ROWS int not null ,
RESERVED int not null ,
DATA int not null ,
INDEX_SIZE int not null ,
UNUSED int not null ,
USED_MBnumeric(18,4)not null,
USED_GBnumeric(18,4)not null,
AVERAGE_BYTES_PER_ROWnumeric(18,5)null,
AVERAGE_DATA_BYTES_PER_ROWnumeric(18,5)null,
AVERAGE_INDEX_BYTES_PER_ROWnumeric(18,5)null,
AVERAGE_UNUSED_BYTES_PER_ROWnumeric(18,5)null,
)

declare @fetch_status int

declare @proc varchar(200)
select@proc= rtrim(db_name())+'.dbo.sp_spaceused'

declare Cur_Cursor cursor local
for
select
TABLE_NAME=
rtrim(TABLE_SCHEMA)+'.'+rtrim(TABLE_NAME)
from
INFORMATION_SCHEMA.TABLES
where
TABLE_TYPE= 'BASE TABLE'
order by
1

open Cur_Cursor

declare @TABLE_NAME varchar(200)

select @fetch_status = 0

while @fetch_status = 0
begin

fetch next from Cur_Cursor
into
@TABLE_NAME

select @fetch_status = @@fetch_status

if @fetch_status <> 0
begin
continue
end

truncate table #TABLE_SPACE_WORK

insert into #TABLE_SPACE_WORK
(
TABLE_NAME,
TABLE_ROWS,
RESERVED,
DATA,
INDEX_SIZE,
UNUSED
)
exec @proc @objname =
@TABLE_NAME ,@updateusage = 'true'


-- Needed to work with SQL 7
update #TABLE_SPACE_WORK
set
TABLE_NAME = @TABLE_NAME

insert into #TABLE_SPACE_USED
(
TABLE_NAME,
TABLE_ROWS,
RESERVED,
DATA,
INDEX_SIZE,
UNUSED
)
select
TABLE_NAME,
TABLE_ROWS,
RESERVED,
DATA,
INDEX_SIZE,
UNUSED
from
#TABLE_SPACE_WORK

end --While end

close Cur_Cursor

deallocate Cur_Cursor

insert into #TABLE_SPACE
(
TABLE_NAME,
TABLE_ROWS,
RESERVED,
DATA,
INDEX_SIZE,
UNUSED,
USED_MB,
USED_GB,
AVERAGE_BYTES_PER_ROW,
AVERAGE_DATA_BYTES_PER_ROW,
AVERAGE_INDEX_BYTES_PER_ROW,
AVERAGE_UNUSED_BYTES_PER_ROW

)
select
TABLE_NAME,
TABLE_ROWS,
RESERVED,
DATA,
INDEX_SIZE,
UNUSED,
USED_MB=
round(convert(numeric(25,10),RESERVED)/
convert(numeric(25,10),1024),4),
USED_GB=
round(convert(numeric(25,10),RESERVED)/
convert(numeric(25,10),1024*1024),4),
AVERAGE_BYTES_PER_ROW=
case
when TABLE_ROWS <> 0
then round(
(1024.000000*convert(numeric(25,10),RESERVED))/
convert(numeric(25,10),TABLE_ROWS),5)
else null
end,
AVERAGE_DATA_BYTES_PER_ROW=
case
when TABLE_ROWS <> 0
then round(
(1024.000000*convert(numeric(25,10),DATA))/
convert(numeric(25,10),TABLE_ROWS),5)
else null
end,
AVERAGE_INDEX_BYTES_PER_ROW=
case
when TABLE_ROWS <> 0
then round(
(1024.000000*convert(numeric(25,10),INDEX_SIZE))/
convert(numeric(25,10),TABLE_ROWS),5)
else null
end,
AVERAGE_UNUSED_BYTES_PER_ROW=
case
when TABLE_ROWS <> 0
then round(
(1024.000000*convert(numeric(25,10),UNUSED))/
convert(numeric(25,10),TABLE_ROWS),5)
else null
end
from
(
select
TABLE_NAME,
TABLE_ROWS,
RESERVED=
convert(int,rtrim(replace(RESERVED,'KB',''))),
DATA=
convert(int,rtrim(replace(DATA,'KB',''))),
INDEX_SIZE=
convert(int,rtrim(replace(INDEX_SIZE,'KB',''))),
UNUSED=
convert(int,rtrim(replace(UNUSED,'KB','')))
from
#TABLE_SPACE_USED aa
) a
order by
TABLE_NAME

print 'Show results in descending order by size in MB'

select * from #TABLE_SPACE order by USED_MB desc
go

drop table #TABLE_SPACE_WORK
drop table #TABLE_SPACE_USED
drop table #TABLE_SPACE




CODO ERGO SUM

View 12 Replies View Related

SQL 2000 Reovery Fails Sometimes. Error Code (Error 3136). How To Make Database Write Mode?

Jan 7, 2008

Hello,

I am applying hourly differential backup to the backup server from production with the following command. This command makes the database on standby server into read only mode.


RESTORE DATABASE ARSYSTEM FROM DISK = 'E:SQL backup from productionsql_full_backup'
WITH MOVE 'arsystem' TO
'd:ardataarsystem.mdf' ,
MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,
STANDBY = 'E:SQL backup from productionSQL daily diff back up'


Now I want to run a command which will put the database in write mode. I have created a job which would make the datbase Write mode. This job runs successfully sometimes and fails sometimes. I need to ensure that the job always succeeds. When it fails, how do I troubleshoot and what is the possible fix?

Thanks in advance.

The error message is

Cannot apply the backup on device 'E:SQL backup from productionSQL daily diff back up' to database 'ARSYSTEM'. [SQLSTATE 42000] (Error 3136) RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.


The steps for the job are as follows with the failing step highlighted in bold.


copy /y "\172.31.9.12Remedy BackupackupSQL backupsql_full_backup" "E:SQL backup from productionsql_full_backup"

copy /y "\172.31.9.12Remedy BackupackupSQL backupSQL daily diff back up" "E:SQL backup from productionSQL daily diff back up"

xp_cmdshell 'net stop "bmc remedy action request system server"'

exec rp_kill_db_processes 'ARSYSTEM'

RESTORE DATABASE ARSYSTEM

FROM DISK = 'E:SQL backup from productionsql_full_backup'

WITH

MOVE 'arsystem' TO 'd:ardataarsystem.mdf' ,

MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,

NORECOVERY


Failing step

RESTORE DATABASE ARSYSTEM

FROM DISK = 'E:SQL backup from productionSQL daily diff back up'

WITH

MOVE 'arsystem' TO 'd:ardataarsystem.mdf' ,

MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,

RECOVERY



xp_cmdshell 'del /f "E:SQL backup from productionsql_full_backup"'

xp_cmdshell 'del /f "E:SQL backup from productionsql daily diff back up"'

xp_cmdshell 'net start "bmc remedy action request system server"'





I have scheduled the following hourly diffential restore job too which never fails.

RESTORE DATABASE ARSYSTEM FROM DISK = 'E:SQL backup from productionsql_full_backup'
WITH MOVE 'arsystem' TO
'd:ardataarsystem.mdf' ,
MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,
STANDBY = 'E:SQL backup from productionSQL daily diff back up'
EXEC MASTER..XP_CMDSHELL 'del /f "E:SQL backup from productionSQL daily diff back up"'

View 12 Replies View Related

Please Test My Script To Analyze Table Keys (was Submitted For Your Review...:)

Feb 25, 2005

Here is a script I wrote that analyzes datasets and returns all the minimal composite and unary keys that uniquely identify records. I wrote it because I frequently have to analyze client spreadsheets and non-normalized data tables.

On my desktop server it took about two minutes to analyze 2000 permutations of a table with 50 columns and 5000 records.

Please try it out for me and let me know if it chokes on anything, or if you see any ways it could be improved!

View 8 Replies View Related

SQL Server Admin 2014 :: How To Analyze Large Procedure Cache

Jun 15, 2015

I want to analyze procedure cache, to find inefficient plans and parameter issues.

I do it trow DMV But my requests to DMV are very slow and demand resources because procedure cache is about several GB Actually I dont need on-line analysis.

Is it possible to have fast snapshot of procedure cache?

View 0 Replies View Related

Excel Data Mining Add-in - Analyze Key Influencers - Remote Processing Issue

Nov 12, 2007

I have installed the excel DM addin and am trying to work through the tutorials -

When I run the 'Analyze Key Influencers' tool against the sample data through a remote AS server I get:
The task was not able to detect any key influencers for the 'Purchased Bike' column. The values of 'Purchased Bike' seem unrelated to values of other columns.

however when I run it against a local AS server I get the expected results.

I can see no differences in settings or setup between the AS instances I am trying to use - perhaps a permissions issue?
Thank you

View 4 Replies View Related

Int Conversion Error.

Nov 6, 2007

  Hi,I keep getting the error:System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value '@qty' to data type int. When I initiate the insert and update.I tried adding a: Convert.ToInt32(TextBox1.Text), but it didn't work.. I also tried fiddling with the update code, but I think it is to do with the insert bool as the update works at the moment..  Could someone help?My code:private bool ExecuteUpdate(int quantity){  SqlConnection con = new SqlConnection(); 
con.ConnectionString = "Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated
Security=True;User Instance=True";  con.Open();  SqlCommand command = new SqlCommand();  command.Connection = con;  TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1");  Label labname = (Label)FormView1.FindControl("Label3");  Label labid = (Label)FormView1.FindControl("Label13");  command.CommandText = "UPDATE Items SET Quantityavailable = Quantityavailable - '@qty' WHERE productID=@productID";  command.Parameters.Add("@qty", TextBox1.Text);  command.Parameters.Add("@productID", labid.Text); command.ExecuteNonQuery();  con.Close();  return true;}    private bool ExecuteInsert(String quantity)    {        SqlConnection con = new SqlConnection();       
con.ConnectionString = "Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated
Security=True;User Instance=True";        con.Open();        SqlCommand command = new SqlCommand();        command.Connection = con;        TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1");        Label labname = (Label)FormView1.FindControl("Label3");        Label labid = (Label)FormView1.FindControl("Label13");       
command.CommandText = "INSERT INTO Transactions
(Usersname,Itemid,itemname,Date,Qty) VALUES
(@User,@productID,@Itemsname,@date,@qty)";         command.Parameters.Add("@User", System.Web.HttpContext.Current.User.Identity.Name);        command.Parameters.Add("@Itemsname", labname.Text);        command.Parameters.Add("@productID", labid.Text);        command.Parameters.Add("@qty", Convert.ToInt32(TextBox1.Text));        command.Parameters.Add("@date", DateTime.Now.ToString());        command.ExecuteNonQuery();        con.Close();        return true;    }protected void Button2_Click(object sender, EventArgs e){  TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox;  ExecuteUpdate(Int32.Parse(TextBox1.Text) );}protected void Button2_Command(object sender, CommandEventArgs e)    {        if (e.CommandName == "Update")        {            TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox;            ExecuteInsert(TextBox1.Text);        }    }  Thanks so much if someone can!Jon

View 3 Replies View Related

Conversion Error

May 3, 2006

Please help.I have an aspx page with a drop down list(ddlCategories), and a datalist(dlLinks).  The drop down lists data property is a uniqueidentifier from a  table.When an item in the list is selected it fires the following:SqlLinks.SelectParameters("CategoryID").DefaultValue = ddlCategories.SelectedValuedlLinks.DataBind()The sqldatasource for the datalist runs a stored procedure (below)sp_GetLinks (@CategoryID ?) ASselect * from links where category = @categoryMy question is, what should @Category be declared as if the category column in the table is a uniqueidentifier?  And what conversion do I need to do I just can't work it out, as I keep getting the following error:Implicit conversion from data type sql_variant to uniqueidentifier is not
allowed. Use the CONVERT function to run this query. 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.Data.SqlClient.SqlException: Implicit conversion from data type
sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run
this query.Source Error:



Line 5: Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlCategories.SelectedIndexChangedLine 6: SqlLinks.SelectParameters("CategoryID").DefaultValue = ddlCategories.SelectedValueLine 7: dlLinks.DataBind()Line 8: End SubLine 9: End ClassSource File:
C:Documents and SettingsKarl WallsMy DocumentsMy
WebsAFRAlinks.aspx.vb    Line: 7 Stack Trace:



[SqlException (0x80131904): Implicit conversion from data type sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run this query.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2305 System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31 System.Data.SqlClient.SqlDataReader.get_MetaData() +62 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +294 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1021 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +20 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +107 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +10 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +7 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +139 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +139 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1659 System.Web.UI.WebControls.BaseDataList.GetData() +53 System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +267 System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +56 System.Web.UI.WebControls.BaseDataList.DataBind() +62 links.DropDownList1_SelectedIndexChanged(Object sender, EventArgs e) in C:Documents and SettingsKarl WallsMy DocumentsMy WebsAFRAlinks.aspx.vb:7 System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +75 System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent() +124 System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +7 System.Web.UI.Page.RaiseChangedEvents() +138 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4507

View 2 Replies View Related

Conversion ERROR

Aug 23, 2004

This is the error message I get: :(
Server: Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

This is the query:
Select Qual_ins.CompanyCode, Qual_ins.ParticipantCode, Qual_ins.Ins_Code, Qual_ins.Plan_Code,
dbo.PremiumRate(Qual_Ins.Crit,Qual_Ins.PQB_Spec,Pl an_Mas.Extend_Fee,
Qual_Ins.Adjpremium,Qual_Ins.Adjpremiumper,Qual_In s.Adjpremend,
GetDate(),Qual_Ins.Cover_Amt, Plan_Mas.CR_A, Plan_Mas.CR_B,
Plan_Mas.CR_C, Plan_Mas.CR_D, Plan_Mas.CR_E, Plan_Mas.CR_F,
Plan_Mas.CR_G, Plan_Mas.CR_H, Plan_Mas.CR_I, Plan_Mas.CR_J,
Plan_Mas.CR_K, Plan_Mas.CR_L, Plan_Mas.CR_M, Plan_Mas.CR_N,
Plan_Mas.CR_O) AS PremiumRate
FROM Qual_ins, Plan_Mas
WHERE Qual_Ins.CompanyCode = 'ACME'
AND Qual_ins.ParticipantCode = 4
AND Plan_Mas.CompanyCode = Qual_ins.CompanyCode
AND Plan_Mas.Ins_Code = Qual_ins.Ins_Code
AND Plan_Mas.Plan_Code = Qual_ins.Plan_Code
Order BY Qual_ins.Ins_Code

Please let me know if you need to see my PremiumRate (User Defined Function) in order to help me elimate this error message.
Any help is appreciate!
I'm new to this.... "Hello" to all!

Shuvi

View 1 Replies View Related

Dts Conversion Error

Apr 20, 2006

I have a dts package that imports data from a comma delimited .csv file.

I'm getting a conversion invalid for datatypes on column pair 1 (source 'col0012' (DBTYPE_STR), destination column 'latitude' (DBTYPE_R8)).

So, the source file is populated as a string for 'col002' and I have that field specified as a float within my table. Float is the correct type for the value.

How can I make the conversion correctly during the dts execution.

Thank you.

View 2 Replies View Related

Conversion Error

May 21, 2008

Using SQL 2005. Getting the following error. Using a cursor to update a table. I need to pass through the table two different times. The fields in the table update fine on the first time through, but on the 2nd time through I get the following error:
Conversion failed when converting datetime from character string.


Thank you for your help. David

FETCH NEXT FROM DEQ INTO
@GRGR_ID,
@SGSG_ID,
@SBSB_ID,
@PASS1_GENERATION_DATE,
@PASS1_TOTAL_AMOUNT_DUE,
@STATUS_FLAG,
@STATUS_FLAG_INSERT_DT

WHILE @@FETCH_STATUS = 0

BEGIN
UPDATE dbo.RPT_DELINQUENCY_TEST
SET PASS1_GENERATION_DATE = GETDATE()
WHERE SBSB_ID=@SBSB_ID AND GRGR_ID=@GRGR_ID

UPDATE dbo.RPT_DELINQUENCY_TEST
SET STATUS_FLAG = 'B'
WHERE SBSB_ID=@SBSB_ID AND GRGR_ID=@GRGR_ID

UPDATE dbo.RPT_DELINQUENCY_TEST
SET STATUS_FLAG_INSERT_DT = GETDATE()
WHERE SBSB_ID=@SBSB_ID AND GRGR_ID=@GRGR_ID

FETCH NEXT FROM DEQ INTO
@GRGR_ID,
@SGSG_ID,
@SBSB_ID,
@PASS1_GENERATION_DATE,
@PASS1_TOTAL_AMOUNT_DUE,
@STATUS_FLAG,
@STATUS_FLAG_INSERT_DT
END

View 4 Replies View Related

Conversion Error

Apr 19, 2007

Hi, can anyone please shed some light on this error:



[OLE DB Destination [466]] Error: There was an error with input column "Price" (518) on input "OLE DB Destination Input" (479). The column status returned was: "Conversion failed because the data value overflowed the specified type.".



The column "price" is a numeric (9)



In the flat file connection manager, the datatype for the price column is a float [dt r4]. I've also tried numeric, etc.



How do I resolve this error?



Thanks much



View 11 Replies View Related

Conversion Error

Dec 21, 2005

Hi all,

Basically I am trying to create a package that will

(A) Create a table with specified datatypes

(B) Use a text Source file for the data

(C) on Success Completion of the "Execute SQL" transform the data from the text into the table.

Connect to DB <-- [TRANSFROM]-- Text (Source) <-- Execute SQL (Create Table)

It all seems to work now but when I run the package I get the following error

The number of failing rows exceeds the maximum specified.

TransformCopy 'DTSTransformation_6'conversion error: Conversion invalid for datatypes on column on pair 1 (source column 'Col007' (DBTYPE_STR),destination column 'Rec_Amt' (DBTYPE_CY)).

But when I go into the TransformDataTask, under transformation and test that column it all works fine, infact I tested all the columns and they all seem to work fine.

It also seems to be creating the same table twice first in the " Execute SQL" task and then again for some reason in the "DataTransform" task. I dont know if that is realted to the problem or not though.

Any idea's or suggestions I could try ?

Im very new to SQL 2000 & DTS so dont rule out any very newbie errors :)

Thanks

View 3 Replies View Related

Datetime Conversion Error?

Jan 17, 2008

 Hi,
I am getting the following error when
executing the ExecuteInsert in the code below..:
 
Conversion failed when converting
datetime from character string.



    private bool
ExecuteInsert(String quantity)   
{[snip]       
con.Open();       
SqlCommand command = new SqlCommand();       
command.Connection = con;       
TextBox TextBox1 =
(TextBox)FormView1.FindControl("TextBox1");       
Label 1 = (Label)FormView1.FindControl("Label3");       
Label 2 = (Label)FormView1.FindControl("Label13");       
command.CommandText = "INSERT INTO Transactions (etc,Date,etc)
VALUES (etc,@date,@etc)";        
command.Parameters.AddWithValue([snip]);       
command.Parameters.AddWithValue([snip]);        command.Parameters.AddWithValue("@date",
DateTime.Now.ToString());        
command.Parameters.AddWithValue([snip]);       
command.Parameters.AddWithValue([snip]);       
command.ExecuteNonQuery();       
con.Close();       
command.Dispose();       
return true;    }    protected
void Button2_Click(object sender, EventArgs e)   
{        TextBox TextBox1 =
FormView1.FindControl("TextBox1") as TextBox;       
bool retVal = ExecuteUpdate(Int32.Parse(TextBox1.Text));       
if (retVal)           
Response.Redirect("~/URL/EXTENSION.aspx");       
Insert();    }    private
void Insert()    {       
TextBox TextBox1 = FormView1.FindControl("TextBox1") as
TextBox;       
ExecuteInsert(TextBox1.Text);    }}  Thanks if someone can help!Jon

View 2 Replies View Related

Strange Conversion Error

Nov 16, 2004

I have a function that retrieves a data set from a passed SQL string. I'm getting this weird error.


Input string was not in a correct format

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.FormatException: Input string was not in a correct format.

Source Error:


Line 205: sSQL = "Select * From LedgerDetails Where LedgerID = " & _LedgerID.ToString()
Line 206: msgbox(sSQL)
Line 207: TransactionDetails = GetDataSet(sSQL)
Line 208:
Line 209: _TransactionsIndex = CShort(Val(GetDataValue("Select Count() From LedgerDetails Where LedgerID = " & CStr(_LedgerID)))) -1


Source File: C:Documents and SettingsOwnerMy DocumentsUniversityFall 2004DSSASP WorkAlgorithmTest.aspx Line: 207

Stack Trace:

[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat) +184
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) +96

[InvalidCastException: Cast from string "Select * From LedgerDetails Wher" to type 'Integer' is not valid.]
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) +211


I have no idea why, but it seems to trying to convert the string into an integer. Both the argument and the parameter in the function are strings. I checked on the internet and the usual response is this is because the SQL is incomplete, but I have it showing me the compiled SQL string, and it is not imcomplete. I've tried hotwiring the query to match something I know will work, and I still get the same error. I've also tried compile the string using .ToString() on my number portion, storing the converted number into a string and only combining strings on the call, using another string variable as a temporary holder, using the String.Concat function, and even CStr. There is no way possible that this thing is an integer when the call is sent...

Any ideas?

Shawn

View 1 Replies View Related

SQL Data Conversion Error

Jul 12, 2005

I'm trying to create a jbo to run in SQL that will update my table DeviationMaster in crcwebauth table, with the value from qvqote in table invoice_tbl in database crcbrio...I get an error in the job that says...SQLSTATE 42000 Error 8114 Error converting data type varchar to numericThe field DNumber in the DeviationMaster table is numeric 9, and qvqote is char 6.I know about the cast/convert, but I havent been able to successfully do this. I was hoping someone could show me how to get around this problem.Here is my current SQL statement that triggers the above error:update crcwebauth.dbo.deviationmaster set ldate =  (select max(qvdate) from crcbrio.dbo.invoice_tbl where DNumber = qvqote)

View 11 Replies View Related

Annoying Conversion Error

Feb 18, 2000

Can someone please help me.

I am running a 'simple' stored procedure from the Query Analyser (command - FindCustomer L18239, [ ]) which should return a name from a customer table from the input id. It does return the name but I keep getting the message
'Server: Msg 245, Level 16, State 1, Procedure FindCustomer, Line 9
Syntax error converting the varchar value 'Kevin ' to a column of data type int.' - Any ideas what I've done wrong?, thanks.

Kevin.

stored-proc (FindCustomer)-

CREATE PROCEDURE FindCustomer
(@CustID [char](30),
@CustName [char](15) OUTPUT)

AS

BEGIN
SELECT @CustName = (SELECT FirstName from Customer where CustId = @CustID)
RETURN @CustName
END

View 2 Replies View Related

Datatype Conversion Error In DTS

Aug 25, 2000

I am using DTS to import a DB2 table from the mainframe and export the table in text format to a shared folder. I want to convert two fields to a date format yyyy-mm-dd. RELSE_Date is in this format and Updtts is a timestamp coming from the mainframe. The text file is all vchar. In dts here is my query pulling from the mainframe
SELECT A.PROD_ORDER_NUMBER, A.DYE_SEQUENCE, A.STYLE,
A.COLOR, A.SIZE, A.STATUS_IND, A.STATUS_CODE,
A.QUANTITY_REC_DC, B.SHIP_OTFQ_QTY,
A.MRP_PACK_CODE, A.LABELS_PRINTED,
date(A.RELSE_DATE) as RELSE_DATE,
date(A.UPDTTS) as UPDtts, A.LOCATION
FROM DB2.WP1_PO_CUST_REQ A,
DB2.WP1_DYE_LOT_REQ B
WHERE A.PROD_ORDER_NUMBER = B.PROD_ORDER_NUMBER
AND A.DYE_SEQUENCE = B.DYE_SEQUENCE
AND A.STYLE = B.STYLE
AND A.COLOR = B.COLOR
AND A.SIZE = B.SIZE
AND (A.PROD_ORDER_NUMBER LIKE '__K____')
When I parse the query it accepts it. When I run the DTS I get an error stating (SQL STATE 220077 SQLCODE -180) The sting representation of a datetime value has invalid syntax. Does anyone have a suggestion on how to convert these fields before the text file is exported or another output format that is similar to .dat in comma delimited format? Thank you.

View 1 Replies View Related







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