hi all.
I am doing a simple sql update and getting below error:
Error Messages:
Server: Msg 8152, Level 16, State 4, Line 1
String or binary data would be truncated.
The statement has been terminated.
I verified that the values specified are within the column length limits of
the table. I tried to searche for troubleshooting guidelines and couldnt
find any.
Please assist. Thanks.Please post your DDL plus the statement that is giving you trouble.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
.
"KristinaY" <KristinaY@.discussions.microsoft.com> wrote in message
news:56B41165-C240-4111-9914-04672C4FA8BF@.microsoft.com...
hi all.
I am doing a simple sql update and getting below error:
Error Messages:
Server: Msg 8152, Level 16, State 4, Line 1
String or binary data would be truncated.
The statement has been terminated.
I verified that the values specified are within the column length limits of
the table. I tried to searche for troubleshooting guidelines and couldnt
find any.
Please assist. Thanks.
Showing posts with label string. Show all posts
Showing posts with label string. Show all posts
Thursday, March 22, 2012
Sunday, February 19, 2012
Error 25 invalid connection string
here is the string:
Data Source=.\MSSQLSERVER;AttachDbFilename="C:\Program Files\Microsoft
SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf" ;Integrated
Security=True;Connect Timeout=30;User Instance=True
i am trying to connect visuyal c# express with sql server 2005 develop
edition
Can someone point what is wrong with my connection string
Try adding the "Initial Catalog=AdventureWorks" key-value pair. What's the
exception message?
See Chapter 9.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"pierre" <pf@.arobas.net> wrote in message
news:uEARym9THHA.4928@.TK2MSFTNGP03.phx.gbl...
> here is the string:
> Data Source=.\MSSQLSERVER;AttachDbFilename="C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf" ;Integrated
> Security=True;Connect Timeout=30;User Instance=True
> i am trying to connect visuyal c# express with sql server 2005 develop
> edition
> Can someone point what is wrong with my connection string
Data Source=.\MSSQLSERVER;AttachDbFilename="C:\Program Files\Microsoft
SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf" ;Integrated
Security=True;Connect Timeout=30;User Instance=True
i am trying to connect visuyal c# express with sql server 2005 develop
edition
Can someone point what is wrong with my connection string
Try adding the "Initial Catalog=AdventureWorks" key-value pair. What's the
exception message?
See Chapter 9.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"pierre" <pf@.arobas.net> wrote in message
news:uEARym9THHA.4928@.TK2MSFTNGP03.phx.gbl...
> here is the string:
> Data Source=.\MSSQLSERVER;AttachDbFilename="C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf" ;Integrated
> Security=True;Connect Timeout=30;User Instance=True
> i am trying to connect visuyal c# express with sql server 2005 develop
> edition
> Can someone point what is wrong with my connection string
Labels:
adventureworks_data,
connection,
database,
error,
files,
invalid,
mdf,
microsoft,
microsoftsql,
mssql,
mssqlserverattachdbfilename,
mysql,
oracle,
program,
server,
source,
sql,
string,
stringdata
Error 25 invalid connection string
here is the string:
Data Source=.\MSSQLSERVER;AttachDbFilename="C:\Program Files\Microsoft
SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf";Integrated
Security=True;Connect Timeout=30;User Instance=True
i am trying to connect visuyal c# express with sql server 2005 develop
edition
Can someone point what is wrong with my connection stringTry adding the "Initial Catalog=AdventureWorks" key-value pair. What's the
exception message?
See Chapter 9.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
----
---
"pierre" <pf@.arobas.net> wrote in message
news:uEARym9THHA.4928@.TK2MSFTNGP03.phx.gbl...
> here is the string:
> Data Source=.\MSSQLSERVER;AttachDbFilename="C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf";Integrated
> Security=True;Connect Timeout=30;User Instance=True
> i am trying to connect visuyal c# express with sql server 2005 develop
> edition
> Can someone point what is wrong with my connection string
Data Source=.\MSSQLSERVER;AttachDbFilename="C:\Program Files\Microsoft
SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf";Integrated
Security=True;Connect Timeout=30;User Instance=True
i am trying to connect visuyal c# express with sql server 2005 develop
edition
Can someone point what is wrong with my connection stringTry adding the "Initial Catalog=AdventureWorks" key-value pair. What's the
exception message?
See Chapter 9.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
----
---
"pierre" <pf@.arobas.net> wrote in message
news:uEARym9THHA.4928@.TK2MSFTNGP03.phx.gbl...
> here is the string:
> Data Source=.\MSSQLSERVER;AttachDbFilename="C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf";Integrated
> Security=True;Connect Timeout=30;User Instance=True
> i am trying to connect visuyal c# express with sql server 2005 develop
> edition
> Can someone point what is wrong with my connection string
Labels:
connection,
database,
error,
files,
invalid,
microsoft,
microsoftsql,
mssqlserverattachdbfilename,
mysql,
oracle,
program,
server,
source,
sql,
string,
stringdata
error 241: Syntax error converting datetime from character string
Hi All, can someone help me,
i've created a stored procedure to make a report by calling it from a website.
I get the message error "241: Syntax error converting datetime from character string" all the time, i tryed some converting things but nothig works, probably it is me that isn't working but i hope someone can help me.
The code i use is:
CREATE proc CP_Cashbox @.mID varchar,@.startdate datetime,@.enddate datetime
as
set dateformat dmy
go
declare @.startdate as varchar
declare @.enddate as varchar
--print "query aan het uitvoeren"
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@.mID' and njdate between '@.startdate' and '@.enddate'
GO
Thanx in front
CyaOriginally posted by Wimmo
Hi All, can someone help me,
i've created a stored procedure to make a report by calling it from a website.
I get the message error "241: Syntax error converting datetime from character string" all the time, i tryed some converting things but nothig works, probably it is me that isn't working but i hope someone can help me.
The code i use is:
CREATE proc CP_Cashbox @.mID varchar,@.startdate datetime,@.enddate datetime
as
set dateformat dmy
go
declare @.startdate as varchar
declare @.enddate as varchar
--print "query aan het uitvoeren"
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@.mID' and njdate between '@.startdate' and '@.enddate'
GO
Thanx in front
Cya
Simple ... just run this command
sp_helptext cp_cashbox
and you will understand.|||Thanx, i tried what you said but it returns the sp code,
which i edited to
CREATE proc CP_Cashbox @.mID varchar,@.startdate datetime,@.enddate datetime
as
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@.mID' and njdate between '@.startdate' and '@.enddate'
but when i exec it now it returns with the same error as before
the exec command i use is:
exec CP_cashbox @.mID = '10001', @.startdate = '01-01-2000', @.enddate = '01-01-2004'
go
can you tell me what i do wrong?
Thanx
Regards Wim|||Originally posted by Wimmo
Thanx, i tried what you said but it returns the sp code,
which i edited to
CREATE proc CP_Cashbox @.mID varchar,@.startdate datetime,@.enddate datetime
as
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@.mID' and njdate between '@.startdate' and '@.enddate'
but when i exec it now it returns with the same error as before
the exec command i use is:
exec CP_cashbox @.mID = '10001', @.startdate = '01-01-2000', @.enddate = '01-01-2004'
go
can you tell me what i do wrong?
Thanx
Regards Wim
Sorry ... should have seen it first time around
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = @.mID and njdate between @.startdate and @.enddate|||thanx that solves the error,
but the strangest thing happened,
when i exec the sp wit the next code:
exec CP_cashbox @.mID = '10001',@.startdate ='01-01-2000',@.enddate = '01-01-2004'
it returns with a Null value
now when i make a query with the same values it returns the correct value. the query i use is :
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '10001' and njdate between '01-01-2000' and '01-01-2004'
What am i doing wrong
Thanx for your precious time
Greet Wim|||try this :
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = @.mID and convert(varchar,njdate,121) between convert(varchar,@.startdate,121) and convert(varchar,@.enddate,121)|||Originally posted by Enigma
try this :
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = @.mID and convert(varchar,njdate,121) between convert(varchar,@.startdate,121) and convert(varchar,@.enddate,121)
it returns the annoying NULL value again|||Can you paste the DDL of the table ...
CREATE proc CP_Cashbox @.mID varchar(x),@.startdate datetime,@.enddate datetime
where x is the width of the machine_id column in your table|||Originally posted by Enigma
Can you paste the DDL of the table ...
CREATE proc CP_Cashbox @.mID varchar(x),@.startdate datetime,@.enddate datetime
where x is the width of the machine_id column in your table
What is DDL?
the with of the machin_id column is 10|||So .. this should work for you
CREATE proc CP_Cashbox
@.mID varchar(10),
@.startdate datetime,
@.enddate datetime
as
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where
machineID = @.mID
and convert(varchar,njdate,121)
between convert(varchar,@.startdate,121)
and convert(varchar,@.enddate,121)|||Thanx alot man i inserted the with of the machine_id column and now it is working. Thanx to your help i really lose some stress today.
Greet Wim:) :) :cool:|||DBA's dont take stress .. they are some of the coolest persons I have seen ... i personally havent seen a dba fuming in public.|||You are completely right, and i am kinda new to this stuf so i am in the proces of becoming on of the coolest!|||Any time you need help you can rely on some of the best dba's i ve known on this site ... especially ... Brett Kaiser, blindman, rnealjr and satya
i myself rely a lot on this site in emergencies|||Originally posted by Enigma
Any time you need help you can rely on some of the best dba's i ve known on this site ... especially ... Brett Kaiser, blindman, rnealjr and satya
i myself rely a lot on this site in emergencies
Thanx for the tip, i think i gonna need some more help in the near future.
i've created a stored procedure to make a report by calling it from a website.
I get the message error "241: Syntax error converting datetime from character string" all the time, i tryed some converting things but nothig works, probably it is me that isn't working but i hope someone can help me.
The code i use is:
CREATE proc CP_Cashbox @.mID varchar,@.startdate datetime,@.enddate datetime
as
set dateformat dmy
go
declare @.startdate as varchar
declare @.enddate as varchar
--print "query aan het uitvoeren"
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@.mID' and njdate between '@.startdate' and '@.enddate'
GO
Thanx in front
CyaOriginally posted by Wimmo
Hi All, can someone help me,
i've created a stored procedure to make a report by calling it from a website.
I get the message error "241: Syntax error converting datetime from character string" all the time, i tryed some converting things but nothig works, probably it is me that isn't working but i hope someone can help me.
The code i use is:
CREATE proc CP_Cashbox @.mID varchar,@.startdate datetime,@.enddate datetime
as
set dateformat dmy
go
declare @.startdate as varchar
declare @.enddate as varchar
--print "query aan het uitvoeren"
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@.mID' and njdate between '@.startdate' and '@.enddate'
GO
Thanx in front
Cya
Simple ... just run this command
sp_helptext cp_cashbox
and you will understand.|||Thanx, i tried what you said but it returns the sp code,
which i edited to
CREATE proc CP_Cashbox @.mID varchar,@.startdate datetime,@.enddate datetime
as
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@.mID' and njdate between '@.startdate' and '@.enddate'
but when i exec it now it returns with the same error as before
the exec command i use is:
exec CP_cashbox @.mID = '10001', @.startdate = '01-01-2000', @.enddate = '01-01-2004'
go
can you tell me what i do wrong?
Thanx
Regards Wim|||Originally posted by Wimmo
Thanx, i tried what you said but it returns the sp code,
which i edited to
CREATE proc CP_Cashbox @.mID varchar,@.startdate datetime,@.enddate datetime
as
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@.mID' and njdate between '@.startdate' and '@.enddate'
but when i exec it now it returns with the same error as before
the exec command i use is:
exec CP_cashbox @.mID = '10001', @.startdate = '01-01-2000', @.enddate = '01-01-2004'
go
can you tell me what i do wrong?
Thanx
Regards Wim
Sorry ... should have seen it first time around
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = @.mID and njdate between @.startdate and @.enddate|||thanx that solves the error,
but the strangest thing happened,
when i exec the sp wit the next code:
exec CP_cashbox @.mID = '10001',@.startdate ='01-01-2000',@.enddate = '01-01-2004'
it returns with a Null value
now when i make a query with the same values it returns the correct value. the query i use is :
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '10001' and njdate between '01-01-2000' and '01-01-2004'
What am i doing wrong
Thanx for your precious time
Greet Wim|||try this :
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = @.mID and convert(varchar,njdate,121) between convert(varchar,@.startdate,121) and convert(varchar,@.enddate,121)|||Originally posted by Enigma
try this :
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = @.mID and convert(varchar,njdate,121) between convert(varchar,@.startdate,121) and convert(varchar,@.enddate,121)
it returns the annoying NULL value again|||Can you paste the DDL of the table ...
CREATE proc CP_Cashbox @.mID varchar(x),@.startdate datetime,@.enddate datetime
where x is the width of the machine_id column in your table|||Originally posted by Enigma
Can you paste the DDL of the table ...
CREATE proc CP_Cashbox @.mID varchar(x),@.startdate datetime,@.enddate datetime
where x is the width of the machine_id column in your table
What is DDL?
the with of the machin_id column is 10|||So .. this should work for you
CREATE proc CP_Cashbox
@.mID varchar(10),
@.startdate datetime,
@.enddate datetime
as
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where
machineID = @.mID
and convert(varchar,njdate,121)
between convert(varchar,@.startdate,121)
and convert(varchar,@.enddate,121)|||Thanx alot man i inserted the with of the machine_id column and now it is working. Thanx to your help i really lose some stress today.
Greet Wim:) :) :cool:|||DBA's dont take stress .. they are some of the coolest persons I have seen ... i personally havent seen a dba fuming in public.|||You are completely right, and i am kinda new to this stuf so i am in the proces of becoming on of the coolest!|||Any time you need help you can rely on some of the best dba's i ve known on this site ... especially ... Brett Kaiser, blindman, rnealjr and satya
i myself rely a lot on this site in emergencies|||Originally posted by Enigma
Any time you need help you can rely on some of the best dba's i ve known on this site ... especially ... Brett Kaiser, blindman, rnealjr and satya
i myself rely a lot on this site in emergencies
Thanx for the tip, i think i gonna need some more help in the near future.
Subscribe to:
Posts (Atom)