MS-Access中的查询:格式化sql UPDATE代码中间的字段

时间:2022-04-13 02:50:00

I am having yet another problem with my data in ms-access.

我在ms-access中的数据还有另外一个问题。

Basically, what i'm doing is using multiple sql statements to pull, sort, and staight up change/manipulate data. The problem that im having currently is that i am trying to use a sql code like this:

基本上,我正在做的是使用多个sql语句来提取,排序和强制更改/操作数据。我目前的问题是我正在尝试使用这样的SQL代码:

UPDATE analyzedCopy2 SET analyzedCopy2.DateRange = #4/21/2009# to #4/29/2009#

but i can't figure out how to reformat DateRange (which is currently a date) to Text in the sql statement. I can't simply set the format manually because the sql code before this one is pulling in all of the data from another table and when that happens it changes the format of DateRange to date automattically since that is the type it is where it is coming from.

但我无法弄清楚如何在sql语句中将DateRange(当前是一个日期)重新格式化为Text。我不能简单地手动设置格式,因为在此之前的sql代码从另一个表中提取所有数据,当发生这种情况时,它会自动将DateRange的格式更改为日期,因为它是它即将到来的类型从。

If anyone knows how to format a column with vba code then that would be fine too since i'm creating a vba code to run the queries in the order i want.

如果有人知道如何使用vba代码格式化列,那么这也很好,因为我正在创建一个vba代码来按我想要的顺序运行查询。

If anyone needs a better explanation of anything just let me know.

如果有人需要更好的解释任何事情,请告诉我。

1 个解决方案

#1


You can use SQL (DDL) to change some aspects of a table:

您可以使用SQL(DDL)来更改表的某些方面:

 ALTER TABLE TableName ALTER COLUMN  ColumnName Text(50)

#1


You can use SQL (DDL) to change some aspects of a table:

您可以使用SQL(DDL)来更改表的某些方面:

 ALTER TABLE TableName ALTER COLUMN  ColumnName Text(50)