Viewing 15 posts - 2,656 through 2,670 (of 7,191 total)
First off, kudos to you for going off and working out for yourself how sp_executesql works. Many posters on these forums would have just expected us to provide the...
April 20, 2016 at 7:25 am
You can set up a job that is scheduled to run whenever SQL Server Agent starts. The job would perform the steps that you do manually now after a...
April 20, 2016 at 4:18 am
It may be because AdventureWorks has some Enterprise-level features in it, and you are attempting to restore on Express edition. You can use this link for a script to...
April 19, 2016 at 9:48 am
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
Viewing 15 posts - 2,656 through 2,670 (of 7,191 total)