SQLチュートリアル

SQL HOME SQLイントロ SQL構文 SQL Select SQL Select Distinct SQL Where SQL And、Or、Not SQLの順序 SQL Insert Into SQLNull値 SQLアップデート SQL削除 SQL Select Top SQLの最小値と最大値 SQLカウント、平均、合計 SQL Like SQLワイルドカード SQL入力 SQLの間 SQLエイリアス SQL結合 SQL内部結合 SQL左結合 SQL右結合 SQL完全結合 SQL自己結合 SQLユニオン SQL Group By SQLを持っている SQLが存在する SQL Any、All SQL Select Into SQL Insert Into Select SQLケース SQLNull関数 SQLストアドプロシージャ SQLコメント SQL演算子

SQLデータベース

SQL Create DB SQLドロップDB SQLバックアップDB SQLテーブルの作成 SQLドロップテーブル SQL ALTER TABLE SQLの制約 SQLはNullではありません SQL独自 SQL主キー SQL外部キー SQLチェック SQLのデフォルト SQLインデックス SQL自動インクリメント SQLの日付 SQLビュー SQLインジェクション SQLホスティング SQLデータ型

SQLリファレンス

SQLキーワード MySQL関数 SQLServerの機能 MSAccess関数 SQLクイック参照

SQLの

SQLの例 SQLクイズ SQL演習 SQL証明書

SQL Server CHARINDEX()関数

❮SQLServerの機能

文字列「Customer」で「t」を検索し、位置を返します。

SELECT CHARINDEX('t', 'Customer') AS MatchPosition;

定義と使用法

CHARINDEX()関数は、文字列内の部分文字列を検索し、位置を返します。

サブストリングが見つからない場合、この関数は0を返します。

注:この関数は、大文字と小文字を区別しない検索を実行します。

構文

CHARINDEX(substring, string, start)

パラメータ値

Parameter Description
substring Required. The substring to search for
string Required. The string to be searched
start Optional. The position where the search will start (if you do not want to start at the beginning of string). The first position in string is 1

技術的な詳細

で動作します: SQL Server(2008以降)、Azure SQLデータベース、Azure SQLデータウェアハウス、Parallel Data Warehouse

その他の例

文字列「Customer」で「OM」を検索し、位置を返します。

SELECT CHARINDEX('OM', 'Customer') AS MatchPosition;

文字列「Customer」で「mer」を検索し、位置を返します(位置3から開始)。

SELECT CHARINDEX('mer', 'Customer', 3) AS MatchPosition;

❮SQLServerの機能