@name varchar(120),
@type varchar(5)
as
begin
declare @Sql varchar(500)
set @Sql = 'select * from sysobjects where name like ''%' + @name +'%'' and type = '''+@type+''' order by name'
print @sql
Exec (@sql)
dropping un-used ones, adding missing ones, and fine-tuning the ones I already have. I thought I’d share some of the scripts I’ve been using to accomplish this. Un-Used Indexes Script Declare @dbid int , @dbName varchar(100); Select @dbid = DB_ID() , @dbName = DB_Name(); With partitionCTE (object_id, index_id, row_count, partition_count) As ( Select [object_id] , index_id , Sum([rows]) As 'row_count' , Count(partition_id) As 'partition_count' From sys.partitions Group By [object_id] , index_id ) Select Object_Name(i.[object_id]) as objectName , i.name , Case When i.is_unique = 1 ...
Stop the SQL services Edit the properties of the SQL Service Change the startup parameters of the SQL service by adding a –m; in front of the existing parameters Start the SQL services. These are now running in Single User Mode. Start CMD on tthe SQL server Start the SQLCMD command. Now we create a new user. Enter following commands CREATE LOGIN recovery WITH PASSWORD = ‘TopSecret 1′ (Remember SQL server has default strong password policy Go Now this user is created Now we grant the user a SYSADMIN roles using the same SQLCMD window. sp_addsrvrolemember ‘recovery’, ‘sysadmin’ go
Being a long-time devotee of all things Microsoft SQL Server, I had quite a bit of learning to do to get up to speed on our new Teradata appliance. This guide attempts to distill some of what I have learned. I will primarily focus on what I have found most lacking: examples of how to convert SQL Server T-SQL to Teradata SQL. This guide will use the vendor-supplied sample databases: SQL Server’s AdventureWorksDW2012 , and the Teradata’s Express 14.0 Retail database . Also, while this is probably self explanatory, the “mufford” object referenced in the Teradata examples is simply my own personal sandbox. You’ll need to replace any “mufford” reference to whatever your development sandbox may be named. Release History: 2012-08-17 – Added UPDATE examples; reformatted 2012-08-12 – Added date examples 2012-08-08 – Initial Release SELECT Statements Simple SELECT SQL Server: Best practice is to qualify the table schema; qualifying the database is optional unless ...
Comments
Post a Comment