i got this -
substring('PA-1501200', 4 , 99)
-
now for some reason i think it sees the number as a date, it should be n varchar and then convert it into a int, then i get this error
Conversion failed when converting datetime from character string.
and here is my sql
the ponumber will be the same as the grid number if i get it to work -
declare @PONumber varchar(50)
-
declare @GridNumber varchar(50)
-
-
-
--set @PONumber =
-
set @GridNumber = substring('PA-1501200', 4 , 99)
-
-
select * from int_err_PutAway_writeback
-
where
-
((refno = @PONumber) and isnull(@PONumber,'') <> '')
-
or
-
((refno = @GridNumber) and isnull(@PONumber,'') = '')
-
and err_datetime is not null
-
union all
-
select *, ' ' ab_res from int_err_Receive_writeback
-
where
-
((refno = @PONumber) and isnull(@PONumber,'') <> '')
-
or
-
((refno = @GridNumber) and isnull(@PONumber,'') = '')
-
and err_datetime is not null
-
union all
-
select * from int_err_ibtPutAway_writeback
-
where
-
((refno = @PONumber) and isnull(@PONumber,'') <> '')
-
or
-
((refno = @GridNumber) and isnull(@PONumber,'') = '')
-
and err_datetime is not null
-
union all
-
select *, ' ' ab_res from int_err_ibtReceive_writeback
-
where
-
((refno = @PONumber) and isnull(@PONumber,'') <> '')
-
or
-
((refno = @GridNumber) and isnull(@PONumber,'') = '')
-
and err_datetime is not null
-
order by err_datetime desc
-
1 1067
Here are the possible reason for your error:
1. If your code passes the line -
set @GridNumber = substring('PA-1501200', 4 , 99)
-
then the error is on your select.
2.Your REFNO column is a date data type.
3. One of the field on your table that you're trying to UNIONize is a date and you're trying to UNION it with a char/varchar column.
Happy Coding!!!
~~ CK
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jim |
last post by:
I'm having a problem with a date query..im trying to pull customer
data based on a date specified from a form to 3 months prior to the
date specified. So lets say in the form I specified 1/2/2004....
|
by: Michael England |
last post by:
I'm having trouble with the Calendar control in ASP.NET using VB. When I
place a calendar on a page and then select a new date, it seems that I have
to select the date twice in order for any...
|
by: Federico |
last post by:
Hi, this is what I can do:
- Create new solutions using VS.Net ASP.Net
- Save the solutions, build the solution, view in browser with the
solution still open.
But, once I close the solution, I...
|
by: Ramakrishnan Nagarajan |
last post by:
Hi,
I am facing a problem in uploading Excel data to the Database. While
uploading my code reads Excel Data using OleDbReader and store into a dataset
by looping through the OleDbReader result...
|
by: G Gerard |
last post by:
Hello
I am having some problem comparing dates with the SQL statement below
MySQL = "SELECT Format(Date, 'yyyy/mmmm/dd') as FROM TblDates WHERE
_
Format(Date, 'yyyy/mmmm/dd') =...
|
by: Bill Nguyen |
last post by:
I'm reading a CSV file with the date colum formatted as "YYMMDD" -"070310"
when viewed in notepad or similar trext editor.
However, in my app, using ODBCReader, the column value becomes "70310"...
|
by: cjordan |
last post by:
Hi everyone. I'm new here, and I think I've got a pretty unique problem (haven't found any solution to this anywhere else), but I'm hoping that someone here can help me.
To be honest, I'm not a...
|
by: cooklooks |
last post by:
http://www.videoriporter.hu/vr/fs?content=/vr/player/1320/date/count
|
by: disney86 |
last post by:
I am setting up Forms in Access 08. I have a form which when opened will auto insert the current time and current date. I need to be able to allow the user to set up paramaters to auto select a...
|
by: Rehana |
last post by:
I am having problem,while inserting date using insert query...In front end am using c#.net and my database is in ms-access..
if am pass date in dd/mm/yy format in insert query..it store as mm/dd/yy...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| | |