Forcing data type in MS Access makes a table query

I have a query in MS Access that creates a table of two subqueries. For the two columns to be created, I divide one column from the first subquery into a column from the second subquery.

The data type of the first column is double; the data type of the second column is decimal, with a scale of 2, but I want the second column to be double as well.

Is there a way to force a data type when creating a table through a standard Access Access query?

+5
source share
5 answers

One way to do this is to explicitly create a table before investing in it.

, , :

SELECT Persons.LastName,Orders.OrderNo
INTO Persons_Order_Backup
FROM Persons
INNER JOIN Orders
ON Persons.P_Id=Orders.P_Id
WHERE FirstName = 'Alistair'

:

----Create NewTable
CREATE TABLE NewTable(FirstName VARCHAR(100), LastName VARCHAR(100), Total DOUBLE)
----INSERT INTO NewTableusing SELECT
INSERT INTO NewTable(FirstName, LastName, Total)
SELECT FirstName, LastName, 
FROM Person p
INNER JOIN Orders o
ON p.P_Id = o.P_Id
WHERE p.FirstName = 'Alistair'

, . , .

+8

FLOAT CDBL(), , , Database Access NULL, , .

SELECT first_column, 
       IIF(second_column IS NULL, NULL, CDBL(second_column)) 
          AS second_column_as_float
  INTO Table666
  FROM MyTest;

... ALTER TABLE , .. CREATE TABLE INSERT INTO..SELECT .

+3
0

- , Append-To Access .

0

, make-table, NUMERIC, .

, ( Stack), - Short Text . , , DELETE , - , DROP TABLE , ...

make- APPEND, ... DELETE .

, !

0

All Articles