|
|
-
|
|
Sometimes when you import data from other system, you may want to clean up data by removing unwanted characters
You can use Replace function. Suppose you want to remove the character ^ from the string
declare @str varchar(100)
set @str='test^ string'
select @str=replace(@str,'^','')
Sele......
|
|
-
|
|
I was asked to findout total size of all the backup files in the folder
As I didnt have access to view the folder of the server, I used this.
I hope it may be helpful
create table #t(files varchar(1000))
Insert into #t
EXEC master..xp_cmdshell 'dir e:\backup'
select
substring(......
|
|
-
|
|
One of the users asked this question in the SQL forum
I have data in the text as follows
AccountNo: 00234543
AccountName: Kickser
City: Chicago
Country:USA
AccountNo: 00234543
AccountName: Annis
City: Seatle
Country:USA
AccountNo: 12234456
AccountName: pargenezzer
City: NYC
Countr......
|
|
-
|
|
John Paul Cook has posted in his blog to show the list of tables that have no Referential Integrity.
What if you want to know list of tables that have no primary and foreign keys?
Here is the query
select
table_name
from
INFORMATION_SCHEMA.TABLES
where
object......
|
|
-
|
|
If you want to know the last Backup/Restore date of database, use the following
--Last Backup date of database
--Method 1
In Management Studio,Expand database,Right Click on the database and click properties
Refer Last Batabase Backup which is availalbe under General
--Method 2
selec......
|
|
-
|
|
It may be very useful if we have feature to take backup or restore a table
I have posted my suggestion here
Table level Backup/Restore
What do you think of it?
......
|
|
-
|
|
In this post, I showed a way to generate 8 characters random password If you have table with data and add a column for password and want to fill that column with random passwords, you can use this approach. I have seen the usage of a function that generates random password, and use that function i......
|
|
-
|
|
Updated Point on BOL is available at http://msdn.microsoft.com/en-us/library/ms143359.aspx......
|
|
-
|
|
Without seeing the table structure,If you are interested in knowing which columns uniquely identify a row in a table, you can use this system procedure
EXEC sp_special_columns table_name
......
|
|
-
|
|
This is used to set the number of rows affected for DML
Declare @test table(number int)
set rowcount 1
insert into @test
select 11 union all select 10
set rowcount 0
select number from @test
The above inserts only one row to the table variable @test
But beware that this wont be s......
|
|