Is there any way to get 'x' rows using a computed value in the 'SELECT TOP' clause.  I know of the 'rowcount' way but that doesnot solve the problem as I am making this query in XML. 
Please HELP!
Regards,
Not a DBA yet
					
					
						User Profile
				
					Collapse
				
			
		
	- 
	
	
	
	
 Select top (7 - (datepart(weekday, Fordate))) from table1
- 
	
	
	
	
 Dear MandlaT,
 
 I am not totally clear what you're asking but maybe you want to do a select on dstControl for the Yeardate you are about to insert so that you do so only if it doesnot exist.
 
 Regards
 MakingDBA
- 
	
	
	
	
 Is it possible to change login of 'dbo'I restored a DB from another machine. I have created my own user 'Alchemy' for a login 'Alchemy'. After I restore this DB, the 'dbo' user connects itself to 'Alchemy' login. sp_change_users _login doesnot work on 'dbo' so how do I link my user 'Alchemy' to the login 'Alchemy'. I am unable to create my 'Alchemy' user in the restored DB and set it to the login 'Alchemy' as it keeps giving me the error
 Server: Msg 15063, Level 16, State 1, Procedure...
No activity results to display
							Show More
							
Leave a comment: