delete using time field

Hi Experts!

I need some basic help that I am just not able to solve myself.  I am so new to SQL that I am sure that I am my own worst enemy.  

We have a large data set that has a number of fields including data time.  This is not a calculated field but rather a "time" field that is populated through an upload of data.  It is not part of date/time but just the time field.  

I want to delete records where the data time is equal to:  19:45:33 and the WHOLEID is equal to 83-SW.  Seems easy enough but I continue to get a boolean error near "time".  I don't know what I am doing wrong but would appreciate the help.  

A
spudmccAsked:
Who is Participating?
 
lwadwellConnect With a Mentor Commented:
Ahh ... I see the problem.  The field "Data Date" has a space in it ... so if you do not put quotes around in like "Data Date" or square brackets like [Data Date] the database thinks you mean the two words separately ... and it complains as it is 'confused' by that.
Does that make sense?
0
 
lwadwellCommented:
Show your SQL please.
0
 
spudmccAuthor Commented:
SELECT "SalesBUP820A"."PriPub", "SalesBUP820A"."PubDG", "SalesBUP820A"."Draw", "SalesBUP820A"."Returns", "SalesBUP820A"."Sales", "SalesBUP820A"."Sout", "SalesBUP820A"."DayCnt", "SalesBUP820A"."DateID", "SalesBUP820A"."PrimaryID", "SalesBUP820A"."DWBNDS", "SalesBUP820A"."md_Retailer", "SalesBUP820A"."WholesaleID", "SalesBUP820A"."Data Date", "SalesBUP820A"."Data Time"
 FROM   "NYP-RetailDataSQL"."dbo"."SalesBUP820A" "SalesBUP820A"
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
lwadwellCommented:
Is that the SQL that fails with the error?
0
 
spudmccAuthor Commented:
Sorry, I told you I am new to SQL so I really need the kindergarden version.

delete from SalesBUP820A
where Data Date='12:11:54' and
WholesaleID='83-SW';

This error message:

Msg 4145, Level 15, State 1, Line 2
An expression of non-boolean type specified in a context where a condition is expected, near 'Date'.
0
 
spudmccAuthor Commented:
That was the solution.  Thank you so much for your patience, time and sharing your knowledge.  I appreciate your help so very much.  

A
0
All Courses

From novice to tech pro — start learning today.