Tech Tips


 * 1) !perl -w

if ( $#ARGV == 2 )

{

print "$ARGV[0]\n";

print "$ARGV[1]\n";

print "$ARGV[2]\n";

}

else { die ( "Usage :: perl qsplit.sql  \n" );

}

my $queryfile = $ARGV[0];

my $inputlist = $ARGV[1];

my $splitcount = $ARGV[2];

my $outputfile = "qout.txt";

open ( QRY, "$queryfile" ) || die "Can Not open $queryfile :$!\n";

open ( INPT, "< $inputlist" ) || die "Can Not open $inputlist :$!\n";

open ( OUT, "> $outputfile" ) || die "Can Not open $outputfile :$!\n";

my $rowcount = 0;

my @query=;

print "Query : @query\n";

while (  ) { $rowcount++;

if ( $rowcount == 1 ) { print OUT "@query". $_; } elsif ( ($rowcount % $splitcount ) == 0 ) { s/,/ ) UNION @query /g;  print OUT $_; } else { print OUT $_; } }

print OUT ")";

perl -lane "s/^/UNION select * from cpartyid where id in ( /g if $.%1000==0;print $_" my.txt > fmt.txt

perl -lane "s/,$/)/g if (($.%1000)-999)==0;print $_" fmt.txt > fmt.txt

bcp tempdb..plus_change in plus_change.txt -c -b200 -t -SNJESMPROD -U esmapp -P esmap1

details of column

SELECT

COLUMN_NAME,data_type,character_maximum_length from information_schema.columns WHERE TABLE_NAME = 'referral'

Table from coulmn

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name =

sp_helpsegment logsegment

select * from master..sysprocesses where spid in (select blocked from master..sysprocesses where blocked > 0)

sp_dba_w active – for blocking proces

sp_dba_lock – for locks

price..sp_space total – space usage.

sp_lock - The class column will display the cursor name for locks associated with a cursor for the current user and the cursor id for other users.

select * from syslogshold where spid > 0

sp_who'576'

sp_showplan 576,null,null,null

dbcc sqltext you can also use this command to get see whats is happening in a block you can do this by

use master go select * from syslogshold this will find the longest running transaction. go dbcc traceon(3604) go dbcc sqltext (104) go