如何在SQL中搜索包含冒号的字符串?(How can i search for a string in SQL which contains a colon?)

有没有办法在SQL中搜索包含冒号的字符串?

例:

我在数据库中有像2009-09-17 05:00:00.0002011-11-10 06:00:00.000的值。 但是我想要所有具有05:的值。

我尝试了以下SQL,但它给了我一个空白的结果:

SELECT cast(narrative_date as datetime)
FROM P_MATTER_NARRATIVE
WHERE cast(narrative_date as datetime)
LIKE '%05:%';

谢谢Rajan


Is there a way I can search for a string in SQL which contains a colon?

Example:

I have values like 2009-09-17 05:00:00.000 and 2011-11-10 06:00:00.000 in the database. But I want all the values which have 05: in them.

I tried the following SQL, but it gives me a blank result:

SELECT cast(narrative_date as datetime)
FROM P_MATTER_NARRATIVE
WHERE cast(narrative_date as datetime)
LIKE '%05:%';

Thanks Rajan


原文:https://stackoverflow.com/questions/31238938
2023-07-03 06:07

满意答案

显然,我上次尝试这个时忘了包含always关键字。

<div style="page-break-after:always"></div>

毕竟这确实最终起作用了。 只需要确保div始终关闭,否则它不会被切断。 或者,也许更安全的方法是使用:

<div style="page-break-before:always"></div>

这样,如果你不小心忘记关闭它,我相信它仍然会削减页面。


Apparently, last time I tried this I forgot to include the always keyword.

<div style="page-break-after:always"></div>

That did end up working after all though. Just have to make sure that div is always closed or else it won't cut. Alternatively, perhaps a safer approach is to use:

<div style="page-break-before:always"></div>

That way if you accidentally forget to close it, I believe it'll still cut the page.

相关问答

更多

wkhtmltopdf page-break-after有空格(wkhtmltopdf page-break-after have whitespace)

我使用的是版本wkhtmltopdf 0.12.0 对我来说,分页符只适用于--print-media-type。 没有它,图像的分页保护可以正常工作,但不能在分页后或之前使用。 我必须为打印介质制作一个特殊的css文件才能使其正常工作。 将纸张尺寸设置为“A3”或使用“溢出:可见”没有任何区别。 另请参阅WKHTMLTOPDF并在Rails上使用pdfkit忽略表分页符 The solution i found was to set the page size to A3, which make...

为特定页面设置浏览器打印机(Set browser printer for specific page)

JavaScript不允许您覆盖客户端浏览器的默认页面设置,因为浏览器通过沙箱脚本来保护硬件和操作系统,以避免任何恶意。 但是您的问题与此问题类似,也许您可以使用Google Cloud Print设置您的打印机,然后使用它的API来执行此操作。 best way is using js print setup extension on firefox. But the extension dos not support over firefox 56. So you have to donwlo...

在vb.net中打开连接到USB的打印机的现金抽屉(Open cash drawer with printer connected to USB in vb.net)

只需按照文档并发送打开抽屉所需的代码序列。 如果您没有打印机的文档,可以在此处查找序列。 我相信在您的打印机上,只需发送ASCII铃声字符(十进制7)就会打开抽屉。 Just follow the documentation and send the sequence of codes needed to open the drawer. You can look up sequences here if you don't have the documentation for your prin...

打印机将在每一页上打印是/否对话框(Yes/No Dialog on every page the printer will print)

我准备被证明是错误的,但我不认为这是微不足道的。 打印后台处理程序没有关于页面开始和结束的假想的概念。 每个页面的位置都依赖于语言,并且打印后台处理程序很难期望解析流以查找每个页面的开始和结束,但一件事情会非常缓慢。 另一种方法是让打印处理器记录每个页面的开始和结束以及此时假脱机文件的偏移量,然后将这些信息分别传递给假脱机程序。 但也有问题。 “RAW打印”功能允许打印应用程序将“stuff”直接插入打印流中,完全绕过打印处理器。 例如,在打印到PostScript打印机时,这对于页面布局应用程序...

打印机页面尺寸问题(Printer Page Size Problem)

您的打印机不允许设置这些属性,或者您超出了允许的最大值。 从Visual Basic参考 如果为不允许设置这些属性的打印机驱动程序设置“高度”和“宽度”属性,则不会发生错误,并且纸张尺寸保持原样。 如果为仅允许指定特定值的打印机驱动程序设置“高度”和“宽度”,则不会发生错误,并且该属性将设置为驱动程序允许的任何值。 例如,您可以将Height设置为150,然后驱动程序将其设置为144。 我不知道为什么当您将Papersize属性设置为256时出现错误。它适用于我。 此外, 该文档指出,“设置打印机...

TSP100和reportviewer 10.0 A7(TSP100 and reportviewer 10.0 A7)

我终于找到了解决方案。 诀窍是使用Microsoft提供的类和热敏打印机提供程序的ESC / POS语言规范将原始数据直接发送到热敏打印机,以格式化数据。 最好的方法是向热敏打印机提供商询问示例代码。 谢谢大家。 I finally found the solution. The trick is to send raw data directly to the thermal printer by using a class provided by Microsoft and the ESC/P...

如何设置Epson打印机上的打印机可打印区域?(How to set printer printable area on Epson printer?)

问题是您正在创建新页面,但未将其添加到PrinterJob 您添加下面的评论。 // Specify the painter painter = new Printing(printerData); pj.setPrintable(painter); PageFormat pf0 = pj.defaultPage(); Paper p = pf0.getPaper(); p.setImageableArea(0, 0, pf0.getWidth(), pf0.getHeight()); pf0.s...

明星tsp100打印机,使其剪切页面(分页)(Star tsp100 printer, make it cut the page (page break))

显然,我上次尝试这个时忘了包含always关键字。 <div style="page-break-after:always"></div> 毕竟这确实最终起作用了。 只需要确保div始终关闭,否则它不会被切断。 或者,也许更安全的方法是使用: <div style="page-break-before:always"></div> 这样,如果你不小心忘记关闭它,我相信它仍然会削减页面。 Apparently, last time I tried this I forgot to include...

采用OPOS的Star TSP700 TSP743U逐行打印(Star TSP700 TSP743U using OPOS prints line-by-line)

ESC + | Epson打印机上的+ N在将字体设置为大,粗等后将字体重置为正常。但是,这会导致Star口吃到剧烈摇晃的程度。 我能够从我的代码中删除该转义序列,并且不会影响Epson打印机的输出,所以现在Star减少了。 注意,它不会停止口吃,它打印50行,翻转2或3行,并重复。 如果您能够在修复之前和之后看到打印机打印,那真的是一个巨大的改进。 ESC + | + N on an Epson printer resets the font to normal after setting it...

page-break / webkit-region-break不再使用chrome了吗?(page-break/webkit-region-break not working in chrome anymore?)

确保元素具有page-break-after: always; 是一个块元素。 另一个选择器可能会将其更改为内联块或其他可防止应用中断的内容。 还要确保元素不在float ed元素中。 谢谢RoadBump。 Make sure the element with page-break-after: always; is a block element. Another selector might be changing it to inline-block or something else w...

相关文章

更多

Solr: a custom Search RequestHandler

As you know, I've been playing with Solr lately, tr ...

Becoming a data scientist

Data Week: Becoming a data scientist Data Pointed, ...

a favorite song

曲名: I COULD BE THE ONE 歌手: Donna Lewis 专辑: blue p ...

Sql Support within Solr-类Sql的solr搜索实现(1)

尽管lucene、solr如此的频繁、如此的普遍被使用。仍然有许多人、需要开发者所见即所得的方式,将查 ...

ServletOutputStream cannot be resolved to a type

在使用jsp生成web图片时遇到这个问题,这是源代码中的一条语句,源代码可以执行,可是一将源码放入ec ...

Stack Overflow Architecture Update - Now At 95 Million Page Views A Month

A lot has happened since my first article on theSta ...

ElasticSearch入门-Bulk,Search操作

其实在上一篇博客中,只要大家能看懂,就应该能够根据其代码做到举一反三了,依次类推ES的批量操作Bulk ...

Spark - A Fault-Tolerant Abstraction for In-Memory Cluster Computing

http://spark-project.org/ 项目首页 http://shark.cs.berk ...

Java String类

Java String类 字符串广泛应用在Java编程中,在Java中字符串属于对象,Java提 ...

sql问题

有表格如下: t_table 8 想得到这样的结果:(只取有重复的第一个,相同的排除,例如f) 1 a ...

最新问答

更多

您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)

将diff文件复制到存储库的根目录,然后执行以下操作: git apply yourcoworkers.diff 有关apply命令的更多信息, apply 见其手册页 。 顺便说一下:一个更好的方法是通过文件交换整个提交文件是发送者上的命令git format-patch ,然后在接收器上加上git am ,因为它也传送作者信息和提交信息。 如果修补程序应用程序失败,并且生成diff的提交实际上在您的备份中,则可以使用尝试在更改中合并的apply程序的-3选项。 它还适用于Unix管道,如下

将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)

尝试将第二行更改为snprintf(buf1, sizeof buf1, "%.2f", balance1); 。 另外,为什么要声明用该特定表达式分配缓冲区的存储量? EDIT @LưuVĩnhPhúc在下面的评论中提到我的原始答案中的格式说明符将舍入而不是截断,因此根据如何在不使用C舍入的情况下截断小数,您可以执行以下操作: float balance = 200.56866; int tmp = balance1 * 100; float balance1 = tmp / 100.0; c

OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)

这是简单的解决方案 在你需要写的控制器中 BackendMenu::setContext('Archetypics.Team', 'website', 'team'); 请参阅https://octobercms.com/docs/backend/controllers-views-ajax#navigation-context BackendMenu::setContext('Author.Plugin name', 'Menu code', 'Sub menu code'); 你需要在r

页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)

每当发出请求时ASP都会创建一个新的Page对象,并且一旦它将响应发送回用户就不会保留对该Page对象的引用,因此只要你找不到某种方法来保持生命自己引用该Page对象后,一旦发送响应, Page和只能通过该页面访问的所有对象才有资格进行垃圾回收。 ASP creates a new Page object whenever a request is made, and it does not hold onto the reference to that Page object once it

codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)

要在生产服务器中调试这个,你可以临时放 error_reporting(E_ALL); 并查看有哪些其他错误阻止正确的重定向。 您还应该检查生产服务器发送的响应标头。 它是否具有“缓存”,是否需要重新验证标头等 to debug this in production server, you can temporary put error_reporting(E_ALL); and see what other errors are there that prevents the proper

在计算机拍照在哪里进入

打开娥的电脑.在下面找到视频设备点击进去就可以了...

使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)

你是对的。 第一次输入后,换行符将保留在输入缓冲区中。 第一次读取后尝试插入: cin.ignore(); // to ignore the newline character 或者更好的是: //discards all input in the standard input stream up to and including the first newline. cin.ignore(numeric_limits::max(), '\n'); 您必须为#inc

No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)

for (int k = 0; k > 10; k++) { System.out.println(k); } k不大于10,所以循环将永远不会执行。 我想要什么是k<10 ,不是吗? for (int k = 0; k < 10; k++) { System.out.println(k); } for (int k = 0; k > 10; k++) { System.out.println(k); } k is not greater than 10, so loop

单页应用程序:页面重新加载(Single Page Application: page reload)

优点是不注销会避免惹恼用户,以至于他们会想要杀死你:-)。 说真的,如果每次刷新页面时应用程序都会将我注销(或者在新选项卡中打开一个链接),我再也不会使用该应用程序了。 好吧,不要这样做。 确保身份验证令牌存储在刷新后的某个位置,即不在某些JS变量中,而是存储在cookie或本地存储中。 The advantage is that not logging off will avoid pissing off your users so much that they'll want to kill

在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)

EXECUTE IMMEDIATE 'SELECT '||field_val_temp ||' FROM tableb WHERE function_id = :func_val AND rec_key = :rec_key' INTO field_val USING 'STDCUSAC' , yu.rec_key; 和, EXECUTE IMMEDIATE 'UPDATE tablec SET field_val_'||i||' = :field_val' USI