|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with WHERE clauseI have a record on a table/view that has activity_start_date of 8/10/2006
and I cannot get it to display in my SQL. Can someone help, I cannot find the problem. I have tried both BETWEEN and >=/<= and neither one works. Thanks. SELECT activity_seq_nbr, contact, entity_name, activity_start_datetime, issue_seq_nbr, issue_name, activity_note, next_action_date, next_action, est_close_date, urgency_name, CCCUContact_seq_nbr, entity_seq_nbr, assigned_seq_nbr FROM vw_Activity_Contact WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 00:00:00', 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) ORDER BY activity_seq_nbr DESC One way
WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND activity_start_datetime >= '20060801' AND activity_start_datetime < '20060811' ORDER BY activity_seq_nbr DESC Denis the SQL Menace http://sqlservercode.blogspot.com/ David wrote: Show quote > I have a record on a table/view that has activity_start_date of 8/10/2006 > and I cannot get it to display in my SQL. Can someone help, I cannot find > the problem. I have tried both BETWEEN and >=/<= and neither one works. > Thanks. > > SELECT activity_seq_nbr, contact, entity_name, activity_start_datetime, > issue_seq_nbr, issue_name, activity_note, next_action_date, next_action, > est_close_date, urgency_name, CCCUContact_seq_nbr, > entity_seq_nbr, assigned_seq_nbr > FROM vw_Activity_Contact > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 00:00:00', > 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) > ORDER BY activity_seq_nbr DESC Nope. Did not work. FYI, the activity_start_datetime has values like
08/01/2006, 08/10/2006, etc. David Show quote "SQL Menace" <denis.g***@gmail.com> wrote in message news:1157124601.388666.93770@m79g2000cwm.googlegroups.com... > One way > > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > activity_start_datetime >= '20060801' > AND activity_start_datetime < '20060811' > ORDER BY activity_seq_nbr DESC > > Denis the SQL Menace > http://sqlservercode.blogspot.com/ > > > David wrote: >> I have a record on a table/view that has activity_start_date of 8/10/2006 >> and I cannot get it to display in my SQL. Can someone help, I cannot >> find >> the problem. I have tried both BETWEEN and >=/<= and neither one works. >> Thanks. >> >> SELECT activity_seq_nbr, contact, entity_name, >> activity_start_datetime, >> issue_seq_nbr, issue_name, activity_note, next_action_date, next_action, >> est_close_date, urgency_name, CCCUContact_seq_nbr, >> entity_seq_nbr, assigned_seq_nbr >> FROM vw_Activity_Contact >> WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >> (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 00:00:00', >> 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) >> ORDER BY activity_seq_nbr DESC > is that a datetime column or not?
Denis the SQL Menace http://sqlservercode.blogspot.com/ David wrote: Show quote > Nope. Did not work. FYI, the activity_start_datetime has values like > 08/01/2006, 08/10/2006, etc. > > David > "SQL Menace" <denis.g***@gmail.com> wrote in message > news:1157124601.388666.93770@m79g2000cwm.googlegroups.com... > > One way > > > > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > > activity_start_datetime >= '20060801' > > AND activity_start_datetime < '20060811' > > ORDER BY activity_seq_nbr DESC > > > > Denis the SQL Menace > > http://sqlservercode.blogspot.com/ > > > > > > David wrote: > >> I have a record on a table/view that has activity_start_date of 8/10/2006 > >> and I cannot get it to display in my SQL. Can someone help, I cannot > >> find > >> the problem. I have tried both BETWEEN and >=/<= and neither one works. > >> Thanks. > >> > >> SELECT activity_seq_nbr, contact, entity_name, > >> activity_start_datetime, > >> issue_seq_nbr, issue_name, activity_note, next_action_date, next_action, > >> est_close_date, urgency_name, CCCUContact_seq_nbr, > >> entity_seq_nbr, assigned_seq_nbr > >> FROM vw_Activity_Contact > >> WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > >> (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 00:00:00', > >> 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) > >> ORDER BY activity_seq_nbr DESC > > It is actually a converted datetime column. The view uses below to strip
the time off the field for display purposes. CONVERT(char(10), dbo.activity.activity_start_datetime, 101) AS activity_start_datetime David Show quote "SQL Menace" <denis.g***@gmail.com> wrote in message news:1157126269.801407.86370@b28g2000cwb.googlegroups.com... > is that a datetime column or not? > > > Denis the SQL Menace > http://sqlservercode.blogspot.com/ > > > David wrote: >> Nope. Did not work. FYI, the activity_start_datetime has values like >> 08/01/2006, 08/10/2006, etc. >> >> David >> "SQL Menace" <denis.g***@gmail.com> wrote in message >> news:1157124601.388666.93770@m79g2000cwm.googlegroups.com... >> > One way >> > >> > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >> > activity_start_datetime >= '20060801' >> > AND activity_start_datetime < '20060811' >> > ORDER BY activity_seq_nbr DESC >> > >> > Denis the SQL Menace >> > http://sqlservercode.blogspot.com/ >> > >> > >> > David wrote: >> >> I have a record on a table/view that has activity_start_date of >> >> 8/10/2006 >> >> and I cannot get it to display in my SQL. Can someone help, I cannot >> >> find >> >> the problem. I have tried both BETWEEN and >=/<= and neither one >> >> works. >> >> Thanks. >> >> >> >> SELECT activity_seq_nbr, contact, entity_name, >> >> activity_start_datetime, >> >> issue_seq_nbr, issue_name, activity_note, next_action_date, >> >> next_action, >> >> est_close_date, urgency_name, >> >> CCCUContact_seq_nbr, >> >> entity_seq_nbr, assigned_seq_nbr >> >> FROM vw_Activity_Contact >> >> WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >> >> (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 >> >> 00:00:00', >> >> 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) >> >> ORDER BY activity_seq_nbr DESC >> > > Try chainging your view to NOT convert the date, so you can handle it as a
date time instead of as a string. Then try this SQL: SELECT activity_seq_nbr, contact, entity_name, activity_start_datetime, issue_seq_nbr, issue_name, activity_note, next_action_date, next_action, est_close_date, urgency_name, CCCUContact_seq_nbr, entity_seq_nbr, assigned_seq_nbr FROM vw_Activity_Contact WHERE assigned_seq_nbr = 5741 AND activity_end_status = 1 AND activity_start_datetime >= CONVERT(DATETIME, '2006-08-01 00:00:00', 102)) AND activity_start_datetime < CONVERT(DATETIME, '2006-08-11 00:00:00', 102)) ORDER BY activity_seq_nbr DESC Alternately, you can convert the value back to date time for comparison purposes, but you really should leave datetime columns as such, and handle the display in the application. WHERE assigned_seq_nbr = 5741 AND activity_end_status = 1 AND CONVERT(DATETIME, activity_start_datetime, 23) >= CONVERT(DATETIME, '2006-08-01 00:00:00', 102)) ANDCONVERT(DATETIME, activity_start_datetime, 23) < CONVERT(DATETIME, '2006-08-11 00:00:00', 102)) ORDER BY activity_seq_nbr DESC Show quote "David" <dlch***@lifetimeinc.com> wrote in message news:ud2U4GezGHA.4408@TK2MSFTNGP05.phx.gbl... > It is actually a converted datetime column. The view uses below to strip > the time off the field for display purposes. > > CONVERT(char(10), dbo.activity.activity_start_datetime, 101) AS > activity_start_datetime > > David > "SQL Menace" <denis.g***@gmail.com> wrote in message > news:1157126269.801407.86370@b28g2000cwb.googlegroups.com... > > is that a datetime column or not? > > > > > > Denis the SQL Menace > > http://sqlservercode.blogspot.com/ > > > > > > David wrote: > >> Nope. Did not work. FYI, the activity_start_datetime has values like > >> 08/01/2006, 08/10/2006, etc. > >> > >> David > >> "SQL Menace" <denis.g***@gmail.com> wrote in message > >> news:1157124601.388666.93770@m79g2000cwm.googlegroups.com... > >> > One way > >> > > >> > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > >> > activity_start_datetime >= '20060801' > >> > AND activity_start_datetime < '20060811' > >> > ORDER BY activity_seq_nbr DESC > >> > > >> > Denis the SQL Menace > >> > http://sqlservercode.blogspot.com/ > >> > > >> > > >> > David wrote: > >> >> I have a record on a table/view that has activity_start_date of > >> >> 8/10/2006 > >> >> and I cannot get it to display in my SQL. Can someone help, I cannot > >> >> find > >> >> the problem. I have tried both BETWEEN and >=/<= and neither one > >> >> works. > >> >> Thanks. > >> >> > >> >> SELECT activity_seq_nbr, contact, entity_name, > >> >> activity_start_datetime, > >> >> issue_seq_nbr, issue_name, activity_note, next_action_date, > >> >> next_action, > >> >> est_close_date, urgency_name, > >> >> CCCUContact_seq_nbr, > >> >> entity_seq_nbr, assigned_seq_nbr > >> >> FROM vw_Activity_Contact > >> >> WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > >> >> (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 > >> >> 00:00:00', > >> >> 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) > >> >> ORDER BY activity_seq_nbr DESC > >> > > > > > So, in response to the question, it is NOT a datetime datatype.
Which is causing havoc with the suggestions. -- Show quoteArnie Rowland, Ph.D. Westwood Consulting, Inc Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous "David" <dlch***@lifetimeinc.com> wrote in message news:ud2U4GezGHA.4408@TK2MSFTNGP05.phx.gbl... > It is actually a converted datetime column. The view uses below to strip > the time off the field for display purposes. > > CONVERT(char(10), dbo.activity.activity_start_datetime, 101) AS > activity_start_datetime > > David > "SQL Menace" <denis.g***@gmail.com> wrote in message > news:1157126269.801407.86370@b28g2000cwb.googlegroups.com... >> is that a datetime column or not? >> >> >> Denis the SQL Menace >> http://sqlservercode.blogspot.com/ >> >> >> David wrote: >>> Nope. Did not work. FYI, the activity_start_datetime has values like >>> 08/01/2006, 08/10/2006, etc. >>> >>> David >>> "SQL Menace" <denis.g***@gmail.com> wrote in message >>> news:1157124601.388666.93770@m79g2000cwm.googlegroups.com... >>> > One way >>> > >>> > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >>> > activity_start_datetime >= '20060801' >>> > AND activity_start_datetime < '20060811' >>> > ORDER BY activity_seq_nbr DESC >>> > >>> > Denis the SQL Menace >>> > http://sqlservercode.blogspot.com/ >>> > >>> > >>> > David wrote: >>> >> I have a record on a table/view that has activity_start_date of >>> >> 8/10/2006 >>> >> and I cannot get it to display in my SQL. Can someone help, I cannot >>> >> find >>> >> the problem. I have tried both BETWEEN and >=/<= and neither one >>> >> works. >>> >> Thanks. >>> >> >>> >> SELECT activity_seq_nbr, contact, entity_name, >>> >> activity_start_datetime, >>> >> issue_seq_nbr, issue_name, activity_note, next_action_date, >>> >> next_action, >>> >> est_close_date, urgency_name, >>> >> CCCUContact_seq_nbr, >>> >> entity_seq_nbr, assigned_seq_nbr >>> >> FROM vw_Activity_Contact >>> >> WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >>> >> (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 >>> >> 00:00:00', >>> >> 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) >>> >> ORDER BY activity_seq_nbr DESC >>> > >> > > Could it be that the row you need simply doesn't correspond to all given
criteria? ML --- http://milambda.blogspot.com/ No. If I remove the date parameters the records show up.
David Show quote "ML" <M*@discussions.microsoft.com> wrote in message news:7FE61F88-CC9F-43FF-8DDB-DB1C083D465F@microsoft.com... > Could it be that the row you need simply doesn't correspond to all given > criteria? > > > ML > > --- > http://milambda.blogspot.com/ if the date has a time portion and you do AND CONVERT(DATETIME,
'2006-08-10 00:00:00', 102)) then only the entry at exactly midnight will be grabbed One at 12:01 AM will not that's why you need to do < '20060811' Denis the SQL Menace http://sqlservercode.blogspot.com/ ML wrote: Show quote > Could it be that the row you need simply doesn't correspond to all given > criteria? > > > ML > > --- > http://milambda.blogspot.com/ I even tried the where clause below and still no records.
David WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND (CONVERT(char(8), activity_start_datetime, 112) >= CONVERT(char(8), '8/1/2006', 112)) AND (CONVERT(char(8), activity_start_datetime, 112) <= CONVERT(char(8), '8/11/2006', 112)) Show quote "David" <dlch***@lifetimeinc.com> wrote in message news:%23pyS3pdzGHA.4932@TK2MSFTNGP02.phx.gbl... >I have a record on a table/view that has activity_start_date of 8/10/2006 >and I cannot get it to display in my SQL. Can someone help, I cannot find >the problem. I have tried both BETWEEN and >=/<= and neither one works. >Thanks. > > SELECT activity_seq_nbr, contact, entity_name, > activity_start_datetime, issue_seq_nbr, issue_name, activity_note, > next_action_date, next_action, > est_close_date, urgency_name, CCCUContact_seq_nbr, > entity_seq_nbr, assigned_seq_nbr > FROM vw_Activity_Contact > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 00:00:00', > 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) > ORDER BY activity_seq_nbr DESC > Run dbcc useroptions and looks at your dateformat setting
take a look at this set dateformat dmy declare @activity_start_datetime varchar(50) select @activity_start_datetime ='08/10/2006' if @activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 00:00:00', 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102) print 'yes' else print 'no' set dateformat mdy if @activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 00:00:00', 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102) print 'yes' else print 'no' see the problem? Denis the SQL Menace http://sqlservercode.blogspot.com/ David wrote: Show quote > I even tried the where clause below and still no records. > > David > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > (CONVERT(char(8), activity_start_datetime, 112) >= CONVERT(char(8), > '8/1/2006', 112)) AND (CONVERT(char(8), activity_start_datetime, 112) <= > CONVERT(char(8), '8/11/2006', 112)) > > "David" <dlch***@lifetimeinc.com> wrote in message > news:%23pyS3pdzGHA.4932@TK2MSFTNGP02.phx.gbl... > >I have a record on a table/view that has activity_start_date of 8/10/2006 > >and I cannot get it to display in my SQL. Can someone help, I cannot find > >the problem. I have tried both BETWEEN and >=/<= and neither one works. > >Thanks. > > > > SELECT activity_seq_nbr, contact, entity_name, > > activity_start_datetime, issue_seq_nbr, issue_name, activity_note, > > next_action_date, next_action, > > est_close_date, urgency_name, CCCUContact_seq_nbr, > > entity_seq_nbr, assigned_seq_nbr > > FROM vw_Activity_Contact > > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND > > (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 00:00:00', > > 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) > > ORDER BY activity_seq_nbr DESC > > Bingo! When I formatted the field as mm/dd/yyyy it worked. I'm not sure
the result of the view treated it as a date. But now it works so I'm happy. Thanks for your help! David Show quote "SQL Menace" <denis.g***@gmail.com> wrote in message news:1157127398.221471.141600@h48g2000cwc.googlegroups.com... > Run dbcc useroptions and looks at your dateformat setting > > take a look at this > > set dateformat dmy > > declare @activity_start_datetime varchar(50) > select @activity_start_datetime ='08/10/2006' > > > > if @activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 > 00:00:00', > 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102) > print 'yes' > else > print 'no' > > > set dateformat mdy > > if @activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 > 00:00:00', > 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102) > print 'yes' > else > print 'no' > > see the problem? > > Denis the SQL Menace > http://sqlservercode.blogspot.com/ > > > David wrote: >> I even tried the where clause below and still no records. >> >> David >> WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >> (CONVERT(char(8), activity_start_datetime, 112) >= CONVERT(char(8), >> '8/1/2006', 112)) AND (CONVERT(char(8), activity_start_datetime, 112) <= >> CONVERT(char(8), '8/11/2006', 112)) >> >> "David" <dlch***@lifetimeinc.com> wrote in message >> news:%23pyS3pdzGHA.4932@TK2MSFTNGP02.phx.gbl... >> >I have a record on a table/view that has activity_start_date of >> >8/10/2006 >> >and I cannot get it to display in my SQL. Can someone help, I cannot >> >find >> >the problem. I have tried both BETWEEN and >=/<= and neither one works. >> >Thanks. >> > >> > SELECT activity_seq_nbr, contact, entity_name, >> > activity_start_datetime, issue_seq_nbr, issue_name, activity_note, >> > next_action_date, next_action, >> > est_close_date, urgency_name, CCCUContact_seq_nbr, >> > entity_seq_nbr, assigned_seq_nbr >> > FROM vw_Activity_Contact >> > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >> > (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 >> > 00:00:00', >> > 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) >> > ORDER BY activity_seq_nbr DESC >> > > If you are converting the datetime to a character string of the form
mm/dd/yyyy and comparing it as a character string, it is only appearing to work because of your test data. For example, as a character string, '08/05/2004' is between '08/01/2006' and '08/10/2006', but, obviously, as datetimes, it is not. And SQL Server will almost certainly not be able to use an index on your datetime column in your table that underlies the view, so your performance may be bad. Datetimes should be compared as datetimes, not character strings. "SQL Menace"s suggestion in his other post is correct, change the view (or create a new view) so that it returns the datetime as a datetime, that is wiithout converting it. Then do your comparison as a datetime, something like, WHERE activity_start_datetime >= CONVERT(DATETIME, '20060801') AND activity_start_datetime < CONVERT(DATETIME, '20060810) Tom Show quote "David" <dlch***@lifetimeinc.com> wrote in message news:uzDxrLezGHA.4368@TK2MSFTNGP02.phx.gbl... > Bingo! When I formatted the field as mm/dd/yyyy it worked. I'm not sure > the result of the view treated it as a date. But now it works so I'm > happy. Thanks for your help! > > David > "SQL Menace" <denis.g***@gmail.com> wrote in message > news:1157127398.221471.141600@h48g2000cwc.googlegroups.com... >> Run dbcc useroptions and looks at your dateformat setting >> >> take a look at this >> >> set dateformat dmy >> >> declare @activity_start_datetime varchar(50) >> select @activity_start_datetime ='08/10/2006' >> >> >> >> if @activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 >> 00:00:00', >> 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102) >> print 'yes' >> else >> print 'no' >> >> >> set dateformat mdy >> >> if @activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 >> 00:00:00', >> 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102) >> print 'yes' >> else >> print 'no' >> >> see the problem? >> >> Denis the SQL Menace >> http://sqlservercode.blogspot.com/ >> >> >> David wrote: >>> I even tried the where clause below and still no records. >>> >>> David >>> WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >>> (CONVERT(char(8), activity_start_datetime, 112) >= CONVERT(char(8), >>> '8/1/2006', 112)) AND (CONVERT(char(8), activity_start_datetime, 112) <= >>> CONVERT(char(8), '8/11/2006', 112)) >>> >>> "David" <dlch***@lifetimeinc.com> wrote in message >>> news:%23pyS3pdzGHA.4932@TK2MSFTNGP02.phx.gbl... >>> >I have a record on a table/view that has activity_start_date of >>> >8/10/2006 >>> >and I cannot get it to display in my SQL. Can someone help, I cannot >>> >find >>> >the problem. I have tried both BETWEEN and >=/<= and neither one >>> >works. >>> >Thanks. >>> > >>> > SELECT activity_seq_nbr, contact, entity_name, >>> > activity_start_datetime, issue_seq_nbr, issue_name, activity_note, >>> > next_action_date, next_action, >>> > est_close_date, urgency_name, >>> > CCCUContact_seq_nbr, >>> > entity_seq_nbr, assigned_seq_nbr >>> > FROM vw_Activity_Contact >>> > WHERE (assigned_seq_nbr = 5741) AND (activity_end_status = 1) AND >>> > (activity_start_datetime BETWEEN CONVERT(DATETIME, '2006-08-01 >>> > 00:00:00', >>> > 102) AND CONVERT(DATETIME, '2006-08-10 00:00:00', 102)) >>> > ORDER BY activity_seq_nbr DESC >>> > >> > > On Fri, 1 Sep 2006 12:52:12 -0400, "Tom Cooper"
<tomcooper@comcast.no.spam.please.net> wrote: >Datetimes should be compared as datetimes, not character strings. "SQL Just to add that there is no reason the view can not include BOTH the>Menace"s suggestion in his other post is correct, change the view (or create >a new view) so that it returns the datetime as a datetime, that is wiithout >converting it. Then do your comparison as a datetime, something like, > >WHERE activity_start_datetime >= CONVERT(DATETIME, '20060801') > AND activity_start_datetime < CONVERT(DATETIME, '20060810) original datetime version and a converted character string version. Just ise different column names. Roy Harvey Beacon Falls, CT |
|||||||||||||||||||||||