Monday, March 26, 2012
formatting the autonumber
used as the primary key allows formatting in which text can be used. Does M
S
SQL Server 2000 allow it as well? If so how does one go about it? Several
A2k databases are also being considered for upsizing and they have the text
in the autonumber thru the formatting.
Thanks to anyone responding.
*** JohnJohnE wrote:
> I am a NEWBIE at this as I am stepping up from A2k. In A2k the
> autonumber used as the primary key allows formatting in which text
> can be used. Does MS SQL Server 2000 allow it as well? If so how
> does one go about it? Several A2k databases are also being
> considered for upsizing and they have the text in the autonumber thru
> the formatting.
> Thanks to anyone responding.
> *** John
SQL Server does not deal with formatting. That is a client issue. Access
is a client and "server" in one. You should do the formatting in your
stored procedures, or preferably, on the client. For numbers in
particular, you could be dealing with different locales that require
different number formatting.
David Gugick
Imceda Software
www.imceda.com|||Nope, identity values are numeric values only. You might consider using a
calculated column for this:
create table test
(
testId int identity,
stringPartOfExposedKey char(10),
exposedKey as stringPartOfExposedKey + cast(testId as varchar(10)
)
or something like it.
----
Louis Davidson - drsql@.hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)
"JohnE" <JohnE@.discussions.microsoft.com> wrote in message
news:8CE12EBA-C7D3-45B5-9CD6-9BFAB40D2E93@.microsoft.com...
>I am a NEWBIE at this as I am stepping up from A2k. In A2k the autonumber
> used as the primary key allows formatting in which text can be used. Does
> MS
> SQL Server 2000 allow it as well? If so how does one go about it?
> Several
> A2k databases are also being considered for upsizing and they have the
> text
> in the autonumber thru the formatting.
> Thanks to anyone responding.
> *** John
Monday, March 19, 2012
Formatting Dates
Soryy for the question because of its simplicity but i'm newbie.
I have a date column in the following format:
2002-04-01 15:16:32.187
I want to query and show this column in the format:
dd/mm/yyyy
How can I do it in a simple query?. I don't want to use cursors or user defined functions.
Thanks in advance.
God Blessselect convert(varchar(10),getdate(),103)
Wednesday, March 7, 2012
Format Parameter Error
Hi all, i am a newbie to reporting services. Hope someone can help me with this date problem.
I have a parameter date which i declared as type string in the report manager. when i entered the date as eg) "31/12/2003" and clicked on the 'preview' tab in the report manager, it gives me error saying that 'Cast from string "31/12/2003" to type 'Date' is not valid.'
So i use the cultureinfo function to set the date to 'en-US' format.... something like the one below:
CStr( Format(DateTime.Parse( Parameters!strDateTo.Value , New System.Globalization.CultureInfo("en-US")), "dd-MMM-yyyy"))
This works perfectly in my preview tab. But when i deployed to the server and when viewed on IE, it gives me an error msg -> "#Error" instead. Why is that so?
I have also checked my pc regional settings . It's set to United States and the date format is also "dd/MM/yyyy". Have also checked the settings in the server and it's also set to the same format. But i am still getting this error.
By the way... i am using windows 2003 with SRS 2000 SP2.
Any help will be appreciated. Thks !
First, why did you create a string parameter and not a date parameter? Second, the interpretation of the input is based on the language specified by the browser, which is why you got something different in the designer vs. when you deployed. Finally, if you want to evaluate strings based on a specific locale, you can just set the locale of the report (report property) to "en-US". You don't need to use a CultureInfo object.