473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

SQL INSERT

I have a table named expense_report. It has over 100 columns in it. Most
of the columns are of type "money(8)". I have a form on my website that I
created using Frontpage and a custom query. I hade to convert most columns
from money to varchar to get the format that I was looking for on the
display page. i.e. $1,265.33. My ultimate goal is to have an e-mail sent
to someone when ever there is a database submisssion. I am following some
directions that I found on the Internet. I have the form and then I am
creating an ASP email handeler page. This calls for an INSERT INTO
statement. I set is up as follows: INSERT INTO expense_report (break_mon,
break_tue) VALUES ('::break_mon::', '::break_tue::') When I verify the
query, it tells me that I can not INSERT varchar into a money column. Do I
have to convert the input to money and then convert to output back to
varchar? How is this done. I am familiar with cast and convert functions,
but only in a SELECT statement. Any help would be appreciated. Thanks!

Darren
MCP
Jul 20 '05 #1
1 16274
Scrappy (ce*****@lan-specialist.com) writes:
I have a table named expense_report. It has over 100 columns in it.
Most of the columns are of type "money(8)". I have a form on my website
that I created using Frontpage and a custom query. I hade to convert
most columns from money to varchar to get the format that I was
looking for on the display page. i.e. $1,265.33.
It is usually better to formatting client-side, as you there can
use regional settings, so that users see for instance dates in a
format they like.
This calls for an INSERT INTO
statement. I set is up as follows: INSERT INTO expense_report
(break_mon, break_tue) VALUES ('::break_mon::', '::break_tue::')
When I verify the query, it tells me that I can not INSERT varchar into a
money column. Do I have to convert the input to money and then convert to
output back to varchar? How is this done. I am familiar with cast and
convert functions, but only in a SELECT statement.


INSERT is no different:

create table #x (m money NOT NULL)
go
insert #x values (convert(money, '$1,265.33'))
go
select * from #x

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Howard Hinnant | last post by:
I recently asked for a survey of multimap insert with hint behavior, in support of a paper I'm writing concerning lwg issue 233. My sincere thanks to Beman Dawes, Raoul Gough, Russell Hind, Bronek...
6
by: Mark P | last post by:
Some time ago I posted here about inserting into a set with a hint: ...
14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
8
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with...
4
by: Chris Kratz | last post by:
Hello all, We have run into what appears to be a problem with rules and subselects in postgres 7.4.1. We have boiled it down to the following test case. If anyone has any thoughts as to why...
2
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
3
by: MP | last post by:
Hi Posted this several hours ago to another ng but it never showed up thought i'd try here. using vb6, ado, .mdb, jet4.0, no access given table tblJob with field JobNumber text(10) 'The...
6
by: lenygold via DBMonster.com | last post by:
Hi everybody: What is the best way to I have 10 tables with similar INSERT requiremnts. INSERT INTO ACSB.VAATAFAE WITH AA(AA_TIN, AA_FILE_SOURCE_CD, .AA_TIN_TYP) AS ( SELECT AA_TIN,...
1
by: EJO | last post by:
with sql 2000 enterprise Trying to build a stored procedure that will take the rows of a parent table, insert them into another table as well as the rows from a child table to insert into...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
tracyyun
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.