检查一串字符是否全部包含在另一个字符串中

时间:2016-10-26 17:30:27

标签: sql sql-server

有谁可以告诉我为什么当我的桌子上有匹配时这段代码没有返回任何值?

CREATE FUNCTION fn_AllEmployeesAndTownsWhichContainLetters(@setOfLetters NVARCHAR(200), @string NVARCHAR(200))
    RETURNS BIT 
        AS
        BEGIN 
            DECLARE @length INT, @i INT
            SET @length = LEN(@string)
            SET @i = 1      
            WHILE (@i < @length)
                BEGIN
                    IF CHARINDEX(SUBSTRING(@string, 1, @i),@setOfLetters) <= 0
                        RETURN 0
                    ELSE
                        SET @i = @i + 1
                END
            RETURN 1
        END GO

1 个答案:

答案 0 :(得分:0)

#!/usr/bin/env python                                                               
import re, os, sys, time, shutil, numpy, cgi, cgitb, json, peewee, playhouse
from peewee import *
from flask import *
cgitb.enable()
mainapp = Flask(__name__)
###Some code here
@mainapp.route("/api/<int:task_id>", methods=['GET'])
def get_task(task_id):
    try:
            j = R.get(R.rid ==task_id)
    except R.DoesNotExist:
            print "aborting because it doens't exist"
            abort(400)
    ##3Take data into Json ready format
    db.close()
    return jsonify(##Json format)

@mainapp.route('/')

curl -i website/api/1
HTTP/1.1 404 NOT FOUND
Date: Wed, 26 Oct 2016 19:52:53 GMT
Server: Apache/2.4.23 (Amazon) PHP/5.6.26 mod_wsgi/3.5 Python/2.7.12
Content-Length: 233
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>