类型为smallmoney,显示为6.5000,怎样使其显示为6.50

qhl9328173 2003-08-21 02:27:26
"单价"字段,类型为smallmoney,
显示为6.5000,怎样使其显示为6.50?
谢谢!
...全文
35 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
pengdali 2003-08-21
  • 打赏
  • 举报
回复
select cast(你的money列 as numeric(10,2)) from 表

就可以了。
zjcxc 元老 2003-08-21
  • 打赏
  • 举报
回复
用convert函数转换成字符型


下表中,左列表示从 money 或 smallmoney 转换为字符数据时的 style 值。

值 输出
0(默认值) 小数点左侧每三位数字之间不以逗号分隔,小数点右侧取两位数,例如 4235.98。
1 小数点左侧每三位数字之间以逗号分隔,小数点右侧取两位数,例如 3,510.92。
2 小数点左侧每三位数字之间不以逗号分隔,小数点右侧取四位数,例如 4235.9819。
CrazyFor 2003-08-21
  • 打赏
  • 举报
回复
select convert(char(20),smallmoney字段,1) from 表
lifeforu 2003-08-21
  • 打赏
  • 举报
回复
如果允许转换成字符显示既可
select convert(varchar,单价,0) from table
《数据库系统概论》 实验报告 班级学号_____ ___ 姓 名_____ ______ 指导老师______ _ __ 目 录 实验一 数据库服务器的连接及数据库的建立 1 实验二 简单SQL查询及数据库多表查询 3 实验三 视图、索引、存储过程和触发器的使用 9 实验四 E-R模型与关系模型的转换 13 实验一 数据库服务器的连接及数据库的建立 1.1实验名称:数据库服务器的连接及数据库的建立 1.2实验类型:验证型 1.3实验学时:3h 1.4实验目的: 了解连接数据库服务器的身份验证模式,熟悉样例数据库。掌握DBMS中利用界面进行 建库建表操作。 1.5实验准备: 1.5.1 数据模型 1.5.2 数据库系统的三级模式结构 1.5.3 DBMS的功能 1.6实验内容 1.6.1熟悉网络环境和数据库环境 1.向输入表中的记录:(每个表最少5条记录,其中一条是与自己相关的真实记录) 1.7思考题: 1. 从用户角度看,数据库系统都有哪些体系结构? 2. 数据库管理系统通常由哪几部分组成? 3. 如何用SQL语句完成上述的工作? 1.8 实验心得(不少于50字) 通过本次实验我学会了数据库的连接,开始我以windows身份登录,但是登录不进去,后来 一SQL service身份登录后成功建立了数据库,然后再建立了要求的表,我发现建立表一定要注意 某些表的要求,尤其是数据类型,是文本型还是数字或者是字符型 实验二 简单SQL查询及数据库多表查询 2.1实验名称:简单SQL查询及数据库多表查询 2.2实验类型:验证型 2.3实验学时:3h 2.4实验目的: 通过本章的学习,用户将能够: 1.掌握向表中添加数据的方法 2.掌握如何快速的把一个表中的多行数据插入到另一个表中 3.掌握更新表中多行数据的方法。 4.学会如何删除表中的一行数据 5.学会如何删除表中的所有行 6.掌握SELECT语句的基本用法 7.使用WHERE子句进行有条件的查询 8.掌握使用IN, NOT IN,BETWEEN来缩小查询范围的方法 9.利用LIKE 子句实现模糊查询 ,利用ORDER子句为结果排序 10.学会用SQL SERVER 的统计函数进行统计计算 11.掌握用GROUP BY 子句实现分组查询的方法。 12.掌握多表查询的技术和嵌套查询的方法。 2.5实验准备: 1、 常用的统计函数: sum() 返回一个数字或计算列的总和 avg() 对一个数字列或计算求列平均值 min() 返回一个数字或一个数字表达式的最小值 max() 返回一个数字或一个数字表达式的最大值 count() 返回满足SELECT语句中指定条件的记录的值 count(*) 返回找到的行数 注意:对于以下类型的数据values值不用使用引号 1、整型数据类型:bit,int,smallint,tinyint 2、货币数据类型:money,smallmoney 3、数字数据类型:decimal,numeric 4、浮点类型数据:real,float 5、简单的日期/时间类型数据:datetime,smalldatetime 对于以下数据类型就要对values值加单引号 1、字符数据类型:char,varchar,text 2、复杂的日期/时间类型数据:datetime,smalldatetime 2、常用SQL语句语法 添加语句: INSERT [INTO] table_or_view [(column_list)] data_values 删除语句: DELETE [ FROM ] table_name WHERE search_condition 更新语句: UPDATE table_name SET column_name = { expression " DEFAULT " NULL }[ ,...n ] [ FROM table_name [ ,...n ] ] WHERE searchcondition 查询语句: SELECT select_list FROM table_source [ WHERE search_condition ] [ GROUP BY group_by_expression ] [ HAVING search_condition ] [ ORDER BY order_expression [ ASC " DESC ] ] 2.6实验内容: 2.6.1 操作一:INSERT(插入) 1、首先检查表结构:(截图,一个就好) 图2-1 输入检查表结构的语句 1. 单条语句插入样例:(截图,向自己的表插入一个记录,前后对比。写出语句) 图2-2 各表插入语句样例 2.6.2 操作二:UPDATE(更新) 4、执行以下更新 在class表中,no_
1. Revision History v2.7 _________________________________________________ * Added: Intelligent code completion for fast query support(Cross-database); * Added: Identity column support; * Added: Refresh schema function; * Added: The "DESC" syntax for stored procedures, functions and views; * Improvement: Table list auto sorting; * Improvement: Generate SQL script formatting; * Improvement: "precision"&"scale" Attribute display Optimization; * Fixed: Corrected data import problem; * Fixed: "describe" grammer problem; * Fixed: Language package problems; * Fixed: "smallmoney" data type display problem(in Oracle); * Fixed: Corrected table structure can not be provided "valid" Attribute bug. 2. About BDB (For new users) _________________________________________________ BDB is a software of database design and database development issued by bainsoft. It supports these database: Oracle, MS SQLServer, Access, MySQL, SQLAnyWhere and Sybase. You can simplify the process of your software development through BDB. 1.The database design. Build the database model by BDB, support forward-engineering and reverse-engineering, and the comparison update and double-way synchronization between the database model and the entity database. 2.The database development Create the program of the database development by BDB. Besides the normal envocation, BDB supply the support of outer command line invoking the database auto-installation. 3.The database auto-update. Carry out the database auto-update without affecting the data of the original table. In addition, you can carry out the database auto-update development quickly and conveniently. The only thing you need to do is to update the resource file automatically generated by BDB. 4.The database migration. Supply a complete database migration schedule. You can carry out migration across the database platforms. The objects that can be migrated include tables, indexes, constraints, default values, triggers, views, procedures, functions and the table data. 5.Inquiry analysis The function of the database’ rapid inquiry analysis allow you to carry out the operation of the table data inquiry, edition and deriving-out: A, supply special SQL editor, and support grammar highlight and script pre-definition. B, support script rapid choice and input. C, supply uniform rapid inquiry grammars support (such as ""DESC"")under different database platforms. 6.SQL script pre-view If there is some changes in the database model or the entity database, you can output and update SQL in advance and preview the database rebuilding SQL script. 7.Support across the database platforms You can design the database only according to the database platform that you are familiar with. When you apply it to other database platforms, the system will transform the data type and deal with the grammar differences under different database platforms. 8.Adopt the scheme pattern Support and carry out multi-database management. 9.Support the definition and synchronization of reusable attributes. 10.Development languages support Opened database physical structure file format(XML standard format). Supply the source program of the outer invocation database, including these three edition: C#/Delphi/JAVA. 11.Support multi-languange New language pack can be added according to your need. www.bainsoft.com

34,575

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧