by Andrew Jackson
11. July 2009 12:23
select cast(convert(varchar, getdate(), 108) as datetime)
Note: Code 108 returns the time portion of a date in the format hh:mm:ss
by Andrew Jackson
7. July 2009 10:57
More a note to myself for this age old problem when restoring SQL databases.
Run this against the database you have the orphaned user in and it will fix the record in the master database.
Username/Password is for the user you need to fix.
EXEC sp_change_users_login 'Auto_Fix', 'username', NULL, 'password'
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
Tags:
SQL
by Andrew Jackson
5. July 2009 12:20
DECLARE @SearchType int
DECLARE @SearchText varchar(50)
SET @SearchType = 1
SET @SearchText = 'A'
SELECT
*
FROM
[TableNameGoesHere]
WHERE
(@SearchType=1 AND [Field1] LIKE @SearchText + '%')
OR
(@SearchType=2 AND [Field2] LIKE @SearchText + '%')
ORDER BY
CASE @SearchType
WHEN 1 THEN [Field1]
WHEN 2 THEN [Field2]
END