Viewing 15 posts - 49,276 through 49,290 (of 49,571 total)
Select TableA.Col1 FROM TableA WHERE TableA.ID = 1;
Select TableB.ColA FROM Table B WHERE TableB.ID = 2
Put that as the commandtext for your .net SQLCommand. It will return 2 recordsets.
That, or write...
January 4, 2006 at 3:34 am
EXECUTE AS LOGIN = 'TestDomain\TestUser'
-- run testing code here
REVERT
You need impersonate rights on the login that you're impersonating.
See ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/613b8271-7f7d-4378-b7a2-5a7698551dbd.htm in the SQL 2005 books online
January 3, 2006 at 4:08 am
A varchar will store spaces if they're part of the string that's put in the variable/field. It just won't pad with spaces to full length like char does.
Note that LEN...
December 29, 2005 at 11:23 pm
And for dynamic sorts...
CREATE PROCEDURE SortedPerson
@SortField VARCHAR(30) = 'Surname'
AS
SELECT title, first_name, surname
FROM Person
ORDER BY CASE @SortField WHEN 'First_Name' THEN first_name
WHEN 'Title' THEN title
ELSE Surname
END
December 23, 2005 at 1:45 am
Here's another way
create procedure FindPeople
@Firstname varchar(30) = '',
@LastName varchar(30) = '',
@Title varchar(5) = ''
AS
Select title, first_name, surname
from person
where first_name LIKE ISNULL(@FirstName,'') + '%'
and last_name LIKE ISNULL(@LastName,'') + '%'
and title LIKE ISNULL(@Title,'') +...
December 23, 2005 at 1:39 am
So many ways to skin a cat.
How about one of my least favorite ways. (Found this in my production system when I...
December 22, 2005 at 6:17 am
Becaust I want to be explicit about round off vs truncate fractions.
December 22, 2005 at 5:24 am
Picky, picky. Close enough. The second 2 ints are treated like a fractional value (select getdate()+0.25)
How is a float stored? (
December 22, 2005 at 5:23 am
If the sort order requested is the same as the clustered sort order, would it now save processing time if the sorting on that column is avoided?
If you do...
December 22, 2005 at 3:53 am
Or my personal favorite way
DECLARE @dt DATETIME
SET @dt = '2005-12-22 14:22'
SELECT CAST(FLOOR(CAST(@dt AS FLOAT)) AS DATETIME)
Takes advantage of the fact that a date is stored like a float, with the time...
December 22, 2005 at 2:57 am
Has the number of text files or size thereof increased recently?
What happens if you invoke the application manually from the OS, not from SQL?
December 21, 2005 at 2:50 am
There may be a limitation that you can't allow CASCADE update or delete when an identity column is involved. Look for that.
There's no problem defining a cascading update/delete if the...
December 21, 2005 at 12:05 am
That would be because SQL's trying to insert the string value 'getDate()' into a datetime field. Bulk insert just puts data into a table. It won't check to see if...
December 20, 2005 at 1:50 am
CityId inthe Title table and TitleId in the city table. Isn't that a circular reference?
And if those aren't the real tables, please post the real table definitions.
December 20, 2005 at 12:16 am
Have a look at the microsoft certification site. There's good info there on the certifications that will be available for SQL 2005 and the exams that comprise them
December 19, 2005 at 11:45 pm
Viewing 15 posts - 49,276 through 49,290 (of 49,571 total)