需要有关 SQL 2000 存储过程的帮助
这是我的逻辑。
我有一个文章表和一个匹配的图像表。图像以二进制格式存储。每个图像表都有每个图像的 2 个实例,这是因为我有 2 个尺寸。 300 x 200 和 500 x 400,其行由 ImageSize 分隔
我想编写一个存储过程来检查 ImageSize=3 是否可用,如果不可用,则从 ImageSize=2 检索。
如何设置我的存储过程来执行此操作?
谢谢
This is my logic.
I have an articles table and a matching images tables. The images are stored in binary format. Each image table has 2 instances of each image, this is because I have 2 sizes. 300 x 200 and 500 x 400 with their rows separated by ImageSize
I want to write a stored procedure that checks if ImageSize=3 is available and if not, then retrieve from ImageSize=2.
How can I set up my stored procedure to do this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用简单的
top 1
找到最大尺寸的图像:You can find the highest size image with a simple
top 1
:安多马尔的回应是完全有效且非常优雅的 - 如果你想要一些更“脚踏实地”的东西,考虑到未来可能涉及其他数值,请尝试这个:
这基本上做了同样的事情 - 但它会继续返回
ImageSize = 3
的Image
,即使您突然也有 4、5 等图像大小代码。Andomar's response is completely valid and very elegant - if you want something more "down to earth", that takes into account there might be other number values involved in the future, try this:
That basically does the same thing - but it'll continue to return the
Image
forImageSize = 3
even if you suddenly also have image sizes codes of 4, 5, and so forth.