Todos Nuevo

user:thomas gists creados por el usuario

title:mygist gists con el título indicado

filename:myfile.txt gists que contienen archivos con el nombre indicado

extension:yml gists que contienen archivos con la extensión indicada

language:go gists que contienen archivos con el lenguaje indicado

topic:homelab gists with given topic

Iniciar sesión


Todos Nuevo Iniciar sesión

All gists matching topic sql-tips

Recientemente creado
Menos reciente creado
Recientemente actualizado
Menos reciente actualizado

timmy / 🧾 SQL Server 輸出 JSON:FOR JSON PATH 超簡單上手

0 gustos
0 bifurcaciones
1 archivos
Última actividad 8 months ago
用 SQL Server 直接產出 JSON,支援巢狀資料結構與根物件命名,後端串接 REST API 不再痛苦 🙌
data-api for-json json-output sql-query sql-server sql-tips
1 SELECT id, name, age -- 選取 id、name 和 age 欄位
2 FROM YourTable -- 從 YourTable 查詢
3 FOR JSON PATH; -- 以 JSON 格式輸出,允許自訂 JSON 結構
4
5 SELECT id, name, age -- 選取 id、name 和 age 欄位
6 FROM YourTable -- 從 YourTable 查詢
7 FOR JSON PATH, ROOT('Users'); -- 以 JSON 格式輸出,並加上 "Users" 作為根物件
Siguiente Anterior

Desarrollado por Opengist ⋅ Load: 18ms⋅

Español
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文