我有一個現有的SQL命令,變量,我想有些生成/可變列添加到它,試圖全面加入沒有條件,但沒有成功,添加列到現有的SQL查詢
SQL是動態變化的將是作爲命令的輸入提供。一些例子可能是什麼和答案應該適用於所有人。
sql = 'SELECT X FROM Y WHERE A = 1'
sql = '(SELECT X FROM F WHERE A = 2)'
sql = 'SELECT X FROM G WHERE B = (SELECT D FROM F WHERE B = 5)'
sql = 'SELECT X FROM H WHERE G = 0'
sql = 'SELECT X FROM P WHERE W = 2'
sql = 'SELECT X FROM Z WHERE J = 9'
SELECT NEWID(), GETDATE(), sql
INSERT INTO Foo (A, B ,C) SELECT NEWID(), GETDATE(), sql
樣品結果,
其中SQL數據庫? – maSTAShuFu
我正在使用mssql – Mert
Mysql不支持GetDate(),NewID()。它應該是SQL Server –