Hello all,
I hope someone can help me; if got a value in a cell (040 1234567),
when I run a query
in the Analyser I got as respons only 40 1234567, so missing the zero
(0) not the whole number is displayed. When I run a query on a cell
with value 1234567 I received the number 1234567 and that's oke. The
Data Type of the Column is Char.
Thanks,
Marko 6 1808
Try it with VARCHAR , which accepts numbers and string
--
Jack
___________________________________
Post IT Jobs for FREE - www.ciquery.com
Over 14,000 registered IT focused individuals
"Marko" <no****@planet.nlwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Hello all,
I hope someone can help me; if got a value in a cell (040 1234567),
when I run a query
in the Analyser I got as respons only 40 1234567, so missing the zero
(0) not the whole number is displayed. When I run a query on a cell
with value 1234567 I received the number 1234567 and that's oke. The
Data Type of the Column is Char.
Thanks,
Marko
Marko (no****@planet.nl) writes:
I hope someone can help me; if got a value in a cell (040 1234567),
when I run a query
in the Analyser I got as respons only 40 1234567, so missing the zero
(0) not the whole number is displayed. When I run a query on a cell
with value 1234567 I received the number 1234567 and that's oke. The
Data Type of the Column is Char.
Cell? Do you mean column value in a row? Or are you running a query
against Excel?
What exact query do you run?
All I can say is that the leading zero should normally not be dropped
for a character value, which this obviously is, there is a space in it.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx
Erland Sommarskog schreef:
Marko (no****@planet.nl) writes:
I hope someone can help me; if got a value in a cell (040 1234567),
when I run a query
in the Analyser I got as respons only 40 1234567, so missing the zero
(0) not the whole number is displayed. When I run a query on a cell
with value 1234567 I received the number 1234567 and that's oke. The
Data Type of the Column is Char.
Cell? Do you mean column value in a row? Or are you running a query
against Excel?
What exact query do you run?
All I can say is that the leading zero should normally not be dropped
for a character value, which this obviously is, there is a space in it.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Hello Erland,
It's a column value in a row, the query I run:
SELECT @Registernum=(
SELECT regnr FROM dbo.planningview
WHERE convert(CHAR(11),date ,106) = convert(CHAR(11),GETDATE(),106)
AND
convert(CHAR(8),Starttime ,108) <= convert(CHAR(8),GETDATE(),108)
AND
convert(CHAR(8),Stoptime ,108) >= convert(CHAR(8),GETDATE(),108) AND
groupName = 'Application' AND shortname = 'Helpdesk' AND deleted =0
)
if (@Registernum is null) Select @Registernum=0
select @Registernum
GO
What I get is 401234567 instaed of 0401234567, so I am missing the 0
(zero).
Marko (no****@planet.nl) writes:
It's a column value in a row, the query I run:
SELECT @Registernum=(
SELECT regnr FROM dbo.planningview
WHERE convert(CHAR(11),date ,106) =
convert(CHAR(11),GETDATE(),106)
AND
convert(CHAR(8),Starttime ,108) <=
convert(CHAR(8),GETDATE(),108)
AND
convert(CHAR(8),Stoptime ,108) >=
convert(CHAR(8),GETDATE(),108) AND
groupName = 'Application' AND shortname = 'Helpdesk' AND
deleted =0
)
if (@Registernum is null) Select @Registernum=0
select @Registernum
GO
What I get is 401234567 instaed of 0401234567, so I am missing the 0
(zero).
You failed to include the declaration of @Registernum. I would guess
you have declared it as integer or decimal.
Also, write conditions like
WHERE convert(CHAR(11),date ,106) = convert(CHAR(11),GETDATE(),106)
as
WHERE date >= convert(char(8), getdate(), 112)
AND date < convert(char(8), dateadd(DAY, getdate() + 1), 112)
This can be essential for performance. If the date column is indexed,
the index is no of use if you put the column into an expression.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for
SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx
Erland Sommarskog schreef:
Marko (no****@planet.nl) writes:
It's a column value in a row, the query I run:
SELECT @Registernum=(
SELECT regnr FROM dbo.planningview
WHERE convert(CHAR(11),date ,106) =
convert(CHAR(11),GETDATE(),106)
AND
convert(CHAR(8),Starttime ,108) <=
convert(CHAR(8),GETDATE(),108)
AND
convert(CHAR(8),Stoptime ,108) >=
convert(CHAR(8),GETDATE(),108) AND
groupName = 'Application' AND shortname = 'Helpdesk' AND
deleted =0
)
if (@Registernum is null) Select @Registernum=0
select @Registernum
GO
What I get is 401234567 instaed of 0401234567, so I am missing the 0
(zero).
You failed to include the declaration of @Registernum. I would guess
you have declared it as integer or decimal.
Also, write conditions like
WHERE convert(CHAR(11),date ,106) = convert(CHAR(11),GETDATE(),106)
as
WHERE date >= convert(char(8), getdate(), 112)
AND date < convert(char(8), dateadd(DAY, getdate() + 1), 112)
This can be essential for performance. If the date column is indexed,
the index is no of use if you put the column into an expression.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Hello Erland,
I put the DECLARE above the Query:
DECLARE @Registernum integer
but no results, I got still the value without the zero (0).
The Data Type of the Column is CHAR, is this maybe wrong?
Marko (no****@planet.nl) writes:
I put the DECLARE above the Query:
DECLARE @Registernum integer
but no results, I got still the value without the zero (0).
The Data Type of the Column is CHAR, is this maybe wrong?
Your result set consists of a single integer variable. QA presents integer
values without leading zeroes. How could it now that the integer value
comes from a char column?
If you want to see a leading zero, you should declare the variable as
char or varchar of suitable length.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: david |
last post by:
Hi,
I have an application as follows:
MySQL database Back-Eend linked to MS Access Front-End and ASP Web
Application.
I require users to enter Serial Numbers such as:
0105123567 (10...
|
by: Brent Eamer |
last post by:
function SetDefaultDate() {
d = new Date();
return d;
}
........
<TD align=left> Start Date: </TD>
<TD align=left> <SELECT name="batchStartDate" size="1" maxlength="50"...
|
by: david |
last post by:
Hi,
I have 2 text boxes on an ASP form.
A user enters a Serial Number in TB1 such as 0105123456, presses tab to
move to TB2, TB2 then displays the value of TB1 after a calculation has
been...
|
by: tmartsum |
last post by:
I am not an expert on C++(/C), but also not a complete beginner.
I was writing a faster cos (and sin) approximation based on
precalculated data (with some success) when I discovered that going...
|
by: Joe Harris |
last post by:
I've searched everywhere but can't find a KB article or forum message
about this one...
Excel Pivot Tables differentiate between +0 (zero) and -0 (negative
zero)and now that I've moved over to...
|
by: Old Wolf |
last post by:
For the following code:
struct S
{
char t;
int flags;
};
void func(void)
{
|
by: Harsha Srinath |
last post by:
Athough this might not be directly relayed to C syntax, I thought some
of you may find this an interesting problem :-
1.One number, in an array integers from 1 to 1,000,000 is present
twice. How...
|
by: Mahesh BS |
last post by:
Hello,
I need to write a query to find out a set of missing number in a given
sequence.
Eg : a Column in some table has the following data
|
by: MC |
last post by:
I have a couple of customers who are using a program that deserializes an
XML file, and on some files, the program fails to see the content of the
file -- treats it as zero length and reports "root...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |