Viewing 15 posts - 2,656 through 2,670 (of 7,187 total)
Incidentally, consider making your code easier to read and maintain by:
(1) Avoiding overuse of subqueries
(2) Using consistent capitalisation
(3) Adding line breaks
(4) Aliasing tables
(5) Presenting it using the code tags on...
April 19, 2016 at 9:02 am
Instead of using EXEC, try sp_executesql, with an output parameter.
John
April 19, 2016 at 8:43 am
This isn't something I've done myself before. Try the nodes method - it may give you what you're looking for.
John
April 19, 2016 at 8:23 am
Astrid
Cast it as varchar, so that you can do comparisons. Please post some DDL and sample data if you need more detailed help than that.
John
April 19, 2016 at 8:00 am
Nuno
If you don't know at design time which table you're going to be querying, you need to use dynamic SQL, where you build a statement to execute and then execute...
April 19, 2016 at 7:43 am
Nuno
You can either join to sys.objects to get the table name, or you can use the OBJECT_ID function. To do the latter, you must run the query in the...
April 19, 2016 at 5:16 am
You need to use dynamic SQL, something like this:
DECLARE @index sysname
DECLARE @DB sysname
DECLARE @schema sysname
DECLARE @table sysname
DECLARE @sql nvarchar(1000)
-- Now assign values to the first four variables
SET @sql = N'ALTER...
April 19, 2016 at 3:31 am
You don't put the values anywhere. The values are passed in from the values of the variables. If you're asking how to assign values to the variables, that...
April 19, 2016 at 3:23 am
Debbie
There's a Parameter Mapping tab in the Execute SQL Task Editor. Just assign a variable to each parameter, taking care that the order of Parameter Name is the same...
April 19, 2016 at 3:02 am
Or this one, which only scans the table once, although it does introduce a sort operation, so you'd want to test to see which performs better. My guess is...
April 18, 2016 at 5:58 am
Beatrix Kiddo (4/18/2016)
April 18, 2016 at 4:50 am
Is this relevant to the thread you've posted in? If not, please start a new one.
It's not clear what your question is. If you're expecting the ALTER TABLE...
April 18, 2016 at 3:17 am
I think I'd set it up so there's a completely different task for the newer versions, and to test for server version in the control flow. That keeps the...
April 18, 2016 at 3:13 am
You're welcome. You do know you shouldn't use TOP without an ORDER BY, don't you? You're risking getting unpredictable results. If, as I suspect, your query only...
April 15, 2016 at 5:11 am
Use a temp table, table variable or staging table and insert into it thus:
INSERT INTO temp_table_or_table_variable_or_staging_table
EXEC ('<whatever>')
You can then select from the temp table, table variable or staging table as...
April 15, 2016 at 4:46 am
Viewing 15 posts - 2,656 through 2,670 (of 7,187 total)