Skip to main content
0 votes
0 answers
59 views

Replace a character with an empty string inside a dynamic SQL using OPENQUERY

I need to replace a certain character inside a field with an empty string. But this simple need becomes complicated because I need to extract data from a remote Oracle server and I need a parameter to ...
tpol's user avatar
  • 195
0 votes
1 answer
58 views

How can I use data from 1 table and then INSERT into a second using data as a column header SQL?

I am trying to build queries to take data from table_1: id path curr_value 1 name Company ABC 2 address 123 Main St 3 name Company 123 And use it as the value AND column header for table_2 in SQL. ...
granger's user avatar
  • 85
-1 votes
1 answer
90 views

Using sp_executesql drop multiple tables

I’m trying to write a script to purge all the tables (and views and functions and procedures) from the current dbo schema in the current database. Bolting together what I have learned from other ...
Manngo's user avatar
  • 16.6k
0 votes
1 answer
52 views

Possible ways of updating the catalog of an already created Linked server

Reason for change I have a main Staging server with multiple linked server's setup. Each one of these Linked Servers have their own DB on the main Staging Server. I have an SP that extracts data from ...
Enzo's user avatar
  • 3
2 votes
2 answers
100 views

How to dynamically build a query based on variable number of fields, in Java with PreparedStatement?

I have a UserDAO class where I need to retrieve users based on different search criteria. Initially, I overloaded the method like this: public User getUserByUsername(String username) throws ...
Nhat Nguyen's user avatar
0 votes
1 answer
37 views

Dropping all Views dynamically in Db2

I want to include a drop everything section in a script which (re)generates a sample database. I know I can find a list of views in the current schema and generate the DROP VIEW statements this way: ...
Manngo's user avatar
  • 16.6k
0 votes
0 answers
76 views

How to create multiple files with different names and content using a comma-separated list without loops?

I have a comma-separated list of file names, and I want to create multiple text files in MySQL. Each file should contain some static text. For example, if my input is: 'file1,file2,file3,file4' I ...
rMafia's user avatar
  • 75
0 votes
1 answer
48 views

Providing string variable into Dynamic SQL SELECT statement WITHOUT it being read as a column name?

I have a situation where I am trying to create a query using Dynamic SQL in SSMS where I am trying to generate a complete file path by concatenating both the name of a parent folder(s) (which change ...
WJTownsend's user avatar
-2 votes
2 answers
54 views

Dynamic sql to retrieve volume count throwing incorrect syntax error [closed]

I am getting incorrect syntax error at 'and Type=0 in the below dynamic sql. What I am trying to achieve is get the volume count of import activities between certain dates where the import id does not ...
Jatin's user avatar
  • 45
1 vote
4 answers
109 views

Switch ASC / DESC in ORDER BY with a CASE construct?

In PostgreSQL, I am trying to have SQL which orders by multiple columns. The first column will always be priority DESC NULLS LAST. The second one needs to be dynamic based on some conditions (for ease ...
sudoExclamationExclamation's user avatar
2 votes
1 answer
77 views

Oracle DBMS_SQL giving ORA-1007 variable not in select list

I get this on Oracle 11g and 19c. Below is a simplified example of the code I am using to process some queries dynamically. It needs to be DBMS_SQL because the actual use case will have various ...
Pro West's user avatar
  • 419
0 votes
0 answers
21 views

Dynamic SQL BCP on local desktop writes no file and generates no error

I have a script task in SSIS that executes Dynamic SQL and builds a BCP statement that is executed in the typical manor. But when editing in SSMS as a SQL script, I can execute it within SSMS and it ...
mf.cummings's user avatar
0 votes
2 answers
44 views

How to return columns from dynamic SQL in Python console

I'm trying to make a CRUD application that uses Oracle procedures for the operations. For the READ component, I wrote a procedure that returns one or more entire rows depending on the specified ...
sodaCodes's user avatar
1 vote
2 answers
102 views

Select one value column from many in a pivot query

I have a table in SQL Server that has rows as follows: ID (int) Name (varchar) IsEnabled (int) ObjectName (varchar) PropertyName (varchar) PropertyValueString (varchar) PropertyValueInt 1 Rule01 1 ...
SoftwareDveloper's user avatar
0 votes
1 answer
67 views

Dynamic Oracle Query, without dynamic

The title is indeed strange, but I will try to explain. I have been programming Oracle (PL-SQL) in version 11G for several years. I recently moved to a new workplace, and in the first task I was ...
StevenU's user avatar
  • 39

15 30 50 per page
1
2 3 4 5
183