October 11, 2006 at 7:41 am
Hi I am starting to build a view in SQL Server 2000. The various fields need to be formatted as below :-
Could someone possibly let me know how I go about doing this.
Field Name | Format |
dflt_cyl_ctf | NUMBER(18,4) |
cyl_ctf_actv | INTEGER |
auto_cnt_drvr_dscr | VARCHAR2(50) |
max_web_wdth | decimal(7,3) |
Any help would be gratefully received.
Thanks!
Nick
October 11, 2006 at 8:01 am
Hello Nick,
Do you want the equivalent data types to SQL 2000? If so, you can check in BOL this topic
data types-SQL Server, overview
Field Name | Format |
dflt_cyl_ctf | NUMERIC(18,4) |
cyl_ctf_actv | INT |
auto_cnt_drvr_dscr | VARCHAR(50) |
max_web_wdth | decimal(7,3) |
Hope this helps.
Thanks
Lucky
October 11, 2006 at 9:51 pm
Don't think that's quite what Nick meant...
Nick... You can do this by creating your view like this....
CREATE VIEW dbo.someviewname AS
SELECT CAST(dflt_cyl_ctf AS DECIMAL(18,4)) AS dflt_cyl_ctf,
CAST(cyl_ctf_actv AS INT) AS cyl_ctf_actv,
CAST(auto_cnt_drvr_dscr AS VARCHAR(50)) AS auto_cnt_drvr_dscr,
CAST(max_web_wdth AS DECIMAL(7,3)) AS max_web_wdth
FROM dbo.yourtable
HOWEVER!!!! Views without the use of CAST return columns that have the same data-type as the columns in the SELECT of the view... why do you thing you need to change them?
--Jeff Moden
Change is inevitable... Change for the better is not.
October 12, 2006 at 2:08 am
Gentlemen,
Excellent replies. Thankyou for your assistance.
Nick
October 12, 2006 at 7:38 am
Thanks Nick... I'm still curious though... why do you need to change the datatype of a column in a view?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply