dynamic-sql
How to tell if SQL stored in a variable will return any rows
If I have a SQL script stored in a variable like this: DECLARE @SQL VARCHAR(MAX) = \'SELECT * FROM Employees WHERE Age > 80\'[详细]
2023-04-12 06:02 分类:问答Is this method of building dynamic SQL vulnerable to SQL injection or bad for performance?
I would like to build a safe dynamic select statement that can handle multiple WHERE clauses. For example the base SQL would look like:[详细]
2023-04-11 14:40 分类:问答How to avoid wild card character and special character when searching from front end
Suppose I have a search functionality in front end written in Java. I have a text box for example name. When I pass a name or a character it works fine, but when I pass any special character, it\'s no[详细]
2023-04-10 05:17 分类:问答DROP FUNCTION without knowing the number/type of parameters?
I keep all my functions in a text file with \'CREATE OR REPLACE FUNCTION somefunction\'. So if I add or change some function I just feed the file to psql.[详细]
2023-04-09 16:21 分类:问答How can i select from table where tablename is specified as SqlParameter?
I am trying to perform dynamic sql select where I am selecting from a table using a parameter. SELECT null FROM @TableName[详细]
2023-04-09 04:26 分类:问答TSQL substitution of key words and code blocks
I have blocks of TSQL that I want to create a MACRO for and then reuse in my SQL file.I want this to be a \'compile\' time thing only.[详细]
2023-04-07 18:46 分类:问答How can a stored procedure calling a TVF be slower than a procedure that inlines the TVF?
Question: I have two views: V_Room, 14969 rows, 9 tables joined together V_parkings, 3265 rows, 9 tables joined together[详细]
2023-04-01 18:08 分类:问答Joining on table value in database
I have a table that holds a relationship of the id to the actu开发者_StackOverflowal name of the joining table, I need to be able to get the actual table name out with an ID value. example:[详细]
2023-03-28 14:18 分类:问答Extend sql query recomendation
I have a table like this a1a2a3a4a5a6a7a8a9a10a11...a25 ---------------------------------------------------------------------------------------[详细]
2023-03-27 21:53 分类:问答Assign output of dynamic SQL to a variable (without stored proc)
I have the code below, where I want to get the id of a row via dynamic SQL. Please note that variables @posselect and @catselect are filled, but I left that out for overview.[详细]
2023-03-26 09:50 分类:问答