I also wanted to know how to spread out sql statement over 3 lines.
I am writing an sql update statment in VB.
I have about 12 fields to update.
[code]
strSQL = "UPDATE [tblServiceUserP ayments]" & _
"Set [tblServiceUserP ayments].[January Payment] = DateSerial(Year (Date()),1,30), [tblServiceUserP ayments].[JanPaymentRec] = False, [tblServiceUserP ayments].[February Payment] = DateSerial(Year (Date()),2,28), [tblServiceUserP ayments].[FebPaymentRec] = False " & _
"WHERE ((([tblServiceUserP ayments].JanPaymentRec) = True) " & _
"AND (([tblServiceUserP ayments].FebPaymentRec) = True));"
[code]
i have 10 more commands like that, and was wondering if it could be spreaded over several lines instead of one long line?
i have tried a few things, but they presented errors.
2 3080
If i put it in a different line, and put the word AND infront of it, the statement infront of the AND does not update, but the rest do
Is there any special characters that we need to use
MMcCarthy 14,534
Recognized Expert Moderator MVP
Try this ... -
strSQL = "UPDATE [tblServiceUserPayments]" & _
-
"Set [tblServiceUserPayments].[January Payment] = DateSerial(Year(Date()),1,30), " & _
-
"[tblServiceUserPayments].[JanPaymentRec] = False, " & _
-
"[tblServiceUserPayments].[February Payment] = DateSerial(Year(Date()),2,28), " & _
-
"[tblServiceUserPayments].[FebPaymentRec] = False " & _
-
"WHERE ((([tblServiceUserPayments].JanPaymentRec)= True) " & _
-
"AND (([tblServiceUserPayments].FebPaymentRec)= True));"
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andreas Paasch |
last post by:
I'm having a little problem here that seems difficult to solve - to me.
I'm working on several tables at one time and once in a while I need to
update them based on a previous select statement.
This ends up with 3-5 statements but every single time I do it this way,
mysql chokes after the 3rd statement, no matter what order.
I'm on Mandrake Linux 9.1, PHP 4.2.3 with mysql 4.0.11a and Apache 1.3.27.
Everything else works like a charm...
|
by: bolidev |
last post by:
I'm new to SQL and can't figure out how to update my table
(StoreItemStatus) that contains the current status for items in each
store (STORE_KEY, ITEM_KEY, STATUS,...).
I get updated status info in a table (I'll call it NewInfo) that
has similar fields. NewInfo may contain multiple records for each
Store/Item, but I will just use the latest status. I'm not sure how
to update StoreItemStatus using each record of NewInfo. Any advice is...
|
by: Jan van Veldhuizen |
last post by:
The UPDATE table FROM syntax is not supported by Oracle.
I am looking for a syntax that is understood by both Oracle and SqlServer.
Example:
Table1:
id name city city_id
1 john newyork null
|
by: rdraider |
last post by:
Hi all,
I'm looking for a way to re-number inventory items. The items exist in 50+
tables, hundreds of fields and there are several thousand items. Maybe one
table could hold the list of old & new items, another table holds the list
of tables/fields to update? How can this be done without needing a million
individual update statements?
A brute force method may look like:
update table1 set field1 = newitem where field1 = olditem
|
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 must be UPDATED, if not, they
must be INSERTED.
Logically then, I would like to SELECT * FROM <TABLE>
WHERE ....<Values entered here>, and then IF FOUND
UPDATE <TABLE> SET .... <Values entered here> ELSE
INSERT INTO <TABLE> VALUES <Values...
| |
by: MaRcElO PeReIrA |
last post by:
Hi there,
I was in troubles with a UPDATE+IN statement:
The following command use to take about 5 minutes to
be done:
UPDATE requisicao SET conclusao='3' WHERE reg IN
(SELECT reg FROM requisicao WHERE now()-data>'15
days');
|
by: Ed L. |
last post by:
I think I'm seeing table-level lock contention in the following function
when I have many different concurrent callers, each with mutually distinct
values for $1. Is there a way to reimplement this function using
select-for-update (or equivalent) in order to get a row-level lock (and
thus less contention) while maintaining the function interface? The docs
seem to suggest so, but it's not clear how to return the SETOF queued_item
and also...
|
by: dba123 |
last post by:
How do I take my GridView and create a function that will update -all-
checkbox values for the submit button's OnClick event? I have posted both my
SQLDataSource and my GridView below:
<asp:SqlDataSource
ID="ds_dashboard"
runat="server"
ConnectionString="<%$ ConnectionStrings:DashboardConn %>"
SelectCommand="Get_Customer_DashboardGraphs"
SelectCommandType="StoredProcedure"
|
by: svgeorge |
last post by:
I want to update several tables using one stored procedure.
How can i do this I mean the syntax.etc. declaration etc.
I know the basic syntax as below
CREATE PROCEDURE <Procedure_Name, sysname, ProcedureName>
-- Add the parameters for the stored procedure here
<@Param1, sysname, @p1> <Datatype_For_Param1, , int> = <Default_Value_For_Param1, , 0>,
<@Param2, sysname, @p2> <Datatype_For_Param2, , int> = <Default_Value_For_Param2, , 0>
AS...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |