Viewing 15 posts - 21,646 through 21,660 (of 22,224 total)
DBA's & Developers, yeah, they should get it because it does have the tools they need to get the job done.
End-users... Why on earth are the end-users generating ad hoc...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 22, 2007 at 6:41 am
Or you could use COALESCE
INSERT INTO [dbo].[TableA]
([Col1],
[Col2],
[Col3])
SELECT
COALESCE([Col1],'unknown'),
COALESCE([Col2],'unknown'),
COALESCE([Col3],'unkown'
FROM [dbo].[TableB];
If you're using the VALUES statement on insert, you can use the default value:
VALUES
(DEFAULT,
'Something',
'Something)
But if you really wanted the defaults to...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 22, 2007 at 6:36 am
insane_professional (10/22/2007)
What i want to do is...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 22, 2007 at 6:23 am
You can do this with client side code in VB. It works, but it's not the best choice since you're sacrificing the power of SQL Server in order to put...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 22, 2007 at 6:14 am
Sorry, I'm stumped. I couldn't do both. I got to learn a bit about the query and value methods of xml data types that I wasn't that aware of, but...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 12:39 pm
ecreese (10/19/2007)
Msg 421, Level 16, State 1, Line 1
The xml data type cannot be selected as DISTINCT because it is not...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 12:10 pm
I tested using the original query, not the DISTINCT. Hang on.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 11:40 am
Oops.
Got it. Add this to the inner join:
FOR XML PATH (''), type
so it looks like this:
SELECT DISTINCT LocalID as "@ID"
, (SELECT ItemUrl
FROM foo X
WHERE f.LocalID=x.LocalID
ORDER BY x.photoseq
FOR XML PATH(''),...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 10:50 am
Just so I had some data to mess with, I modified your query to use something form AdventureWorks:
SELECT A.ProductId "@ID"
,a.Name "Col1"
, (SELECT x.StandardCost
FROM [Production].[ProductCostHistory] X
WHERE A.ProductId=X.[ProductID]
ORDER BY X.StartDate
FOR XML PATH('')
)...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 8:40 am
Until we get the 2008 MERGE statement, you need to do three passes through the data, joining on the incoming data such that you do a batch of updates where...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 8:21 am
Luke L (10/19/2007)
Luke L (10/19/2007)
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 7:08 am
I still don't understand what you mean by tasks & processes. What those are and what you're attempting to compare between the database and the front-end?
Do you mean the queries...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 6:52 am
I'm one of those flaky individuals who kind of backed into this gig. I did four years in the Navy. I was effectively an inheritor of Robert Fulton, working on...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 19, 2007 at 6:31 am
You could try creating a table valued user defined function that uses dynamic sql to run a query against the table you have and then generate a select statement. The...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 18, 2007 at 1:03 pm
There are TONS of ways. Here's one simple one:
SELECT * FROM [INFORMATION_SCHEMA].[TABLES]
WHERE TABLE_SCHEMA = 'dbo'
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 18, 2007 at 12:54 pm
Viewing 15 posts - 21,646 through 21,660 (of 22,224 total)