Monday, April 30, 2007

Shayari

kiyaa baadalo.n me.n safar zindagii bhar
zamii.n par banaayaa na ghar zindagii bhar

sabhii log jiine kaa fan jaanate hai.n
na aayaa hame.n ye hunar zindagii bhar

mohabbat rahii chaar din zindagii me.n
rahaa chaar din kaa asar zindagii bhar

har taraf har jagah beshumaar aadamii
phir bhii tanahaaiiyo.n kaa shikaar aadamii


subah se shaam tak bojh Dhotaa huaa
apanii hii laash kaa Khud mazaar aadamii


har taraf bhaagate dauDate raaste
har taraf aadamii kaa shikaar aadamii


roz jiitaa huaa roz marataa huaa
har nae din nayaa intazaar aadamii


zindagii kaa muqaddar safar dar safar
aaKhirii saa.Ns tak beqaraar aadamii

Lyrics of Meri Kahani

Meri kahani mera kissa ho tum (2)
tumhe kaise bhula sakta hoon,
kaise dil se mita sakta hoon
meri saanson ka hissa ho tum
meri kahani mera kissa ho tum (2)
tumhe kaise bhula sakta hoon,
kaise dil se mita sakta hoon
meri saanson ka hissa ho tum....meri kahani

Hum pyaar ki daur se, bandhe bhi hue hain, toote bhi hue hain (2)
Aur haath se haath yeh, mile bhi hue hain, choote bhi hue hain
Hum saath hain par humsafar nahi,
mere pass nahi toh door sahi,
par meri toh manzil ho tum
meri kahani mera kissa ho tum
tumhe kaise bhula sakta hoon,
kaise dil se mita sakta hoon
meri saanson ka hissa ho tum..meri kahani

Har khushi saath thi, mere tum the magar
ek pal mein tumhe kho diya
dooriyaan chaa gayi, jaise baadal koi aasmaan main phir ro diya
Hum door hue the jaane kyun (2)
ab pass hai toh lagta hai yun, ki ek pal ka, sapna ho tum
meri kahani mera kissa ho tum (2)
tumhe kaise bhula sakta hoon,
kaise dil se mita sakta hoon
meri saanson ka hissa ho tum
meri kahani...meri kahani

Friday, April 27, 2007

OMG check this out

Ophcrack is a Windows password cracker based on a time-memory trade-off using rainbow tables. This is a new variant of Hellman's original trade-off, with better performance. It recovers 99.9% of alphanumeric passwords in seconds.


So, if you can get hands on a windows machine for 3-5 minutes, you can practically have the passwords...

http://ophcrack.sourceforge.net/

Thursday, April 26, 2007

Identity reset for SQL Server 2000

Have you ever wanted to delete all the data from the table just for testing purposes...

It usually takes me around 2 mins to delete the data and reset the identity..

Here is a handy script which would actually reset the seed back to 0

Delete FROM tableName;
DBCC CHECKIDENT('tabelName', RESEED, 0)

Be careful though when working with foreignkeys...

I usually drop all relationships while am testing a perticular table and once the data insertion part makes me happy, I put the relations back and test again...

makes deletions and resets eazier...

Zeehal E Maskin Mukun baranjish

I am compiling some information about the song "Zihaal-e-miskeen mukon
ba-ranjish..." written by Gulzar from the movie Ghulami. I got this
information from a discussion among some Gulzar fans on Orkut.
There is a wonderful remark after the song.

First the meaning of the mukhda:
---------------------------------

zihaal-e-miskeen mukon ba-ranjish, bahaal-e-hijra bechara dil hai

zihaal = notice
miskeen = poor
mukon = do not
ba-ranjish = with ill will, with enimity
bahaal = fresh, recent
hijra = separation

Thus the meaning is: Notice the poor (heart), and do not look at it (heart)
with enimity. It (heart) is fresh with the wounds of separation.

Hindi mein (and more clearly): Ye dil judaai ke gamo se abhi bhi taaza hai.
Iski bechaargi ko ba-ranjish (without enimity) dekho.

Now the full song (it's really beautiful).
---------------------------------------------
(There is equally beautiful remark after the song)

zihaal-e-miskeen mukon ba-ranjish
bahaal-e-hijra bechara dil hai
sunaai deti hai jisaki dhaDakan
tumhaaraa dil ya hamaaraa dil hai

vo aake pahaloo meiN aise baiThe
ke shaam raNgeen ho gayi hai
zaraa zaraa si khili tabeeyat
zaraa si gamgeen ho gayi hai

kabhi kabhi shaam aise Dhalatee hai
jaise ghooNghaT utar rahaa hai
tumhaare seene se uThta dhuaaN
hamaare dil se guzar raha hai

ye sharm hai ya hayaa hai kya hai
najar uThaate hi jhuk gayi hai
tumhaari palakoN se girke shabanam
hamaari aaNkhoN meiN ruk gayi hai


Now a remark
--------------
Many words of this song are in Persian. The phrase "Zihaal-e-miskeen"
comes from a poem of Amir Khusrau. This original poem of Amir Khusrau
is a unique masterpiece. The beautiful thing about this poem is that
it it written in Persian and Brij bhasha simultaneously. The first
line is in Persian, second in Brij bhasha, third in persian, and so
on...!! What an unbelievable talent. And here are first four lines of
that poem.

zihaal-e-miskeen mukon taghaful (Persian)
doraaye nainaan banaye batyaan (Brij)

ke taab-e-hijraah nadarum-e-jaan (Persian)
na laihyo kaahe lagaye chatyaan (Brij)

This showcases Hazrat Amir Khusrau's mastery over the two languages and the
role played by him in the genesis of Urdu.

The complete poem taken from http://www.alif-india.com/ is

Ziehal-e miskeenn makun taghaful, duraye naina banaye batiyan;
ki taab-e hijran nadaram ay jaan, na leho kaahe lagaye chhatiyan.

Shaban-e hijran daraz chun zulf wa roz-e waslat cho umr kotah;
Sakhi piya ko jo main na dekhun to kaise kaatun andheri ratiyan.

Yakayak az dil do chashm-e jadoo basad farebam baburd taskin;
Kise pari hai jo jaa sunaave piyare pi ko hamaari batiyan.

Cho shama sozan cho zarra hairan hamesha giryan be ishq aan meh;
Na neend naina na ang chaina na aap aaven na bhejen patiyan.

Bahaqq-e roz-e wisal-e dilbar ki daad mara ghareeb Khusrau;
Sapet man ke waraaye raakhun jo jaaye paaon piya ke khatiyan.

And the English translation is:

Do not overlook my misery by blandishing your eyes,
and weaving tales; My patience has over-brimmed,
O sweetheart, why do you not take me to your bosom.
Long like curls in the night of separation,
short like life on the day of our union;
My dear, how will I pass the dark dungeon night
without your face before.
Suddenly, using a thousand tricks, the enchanting eyes robbed me
of my tranquil mind;
Who would care to go and report this matter to my darling?
Tossed and bewildered, like a flickering candle,
I roam about in the fire of love;
Sleepless eyes, restless body,
neither comes she, nor any message.
In honour of the day I meet my beloved
who has lured me so long, O Khusrau;
I shall keep my heart suppressed,
if ever I get a chance to get to her trick.

Friday, April 20, 2007

neat asp.net 2.0 tricks

Neat Neat Asp.net 2.0 trickts

Some really neat and interesting stuff...must keep an eye on it

Thursday, April 19, 2007

introducing LINQ.

Paul Vick introduces LINQ.

Here is an excerpt from his blog.

"To start with, LINQ stands for “Language Integrated QUery.” LINQ fundamentally is about integrating query operations into the .NET platform in a comprehensive and open manner. It’s also about providing a unified way for you to query across any kind of data that you have in your program, whether it’s relational, objects or XML. This, we believe, will represent a tectonic shift in the way that VB programmers will work with data. The possibilities that having query capabilities always available right at your fingertips, regardless of the type of data you’re working with, are immense and will fundamentally alter the way people program."

Tuesday, April 17, 2007

best quote of 2006

"You know the world is going crazy when the best rapper is a white guy, the best golfer is a black guy,the tallest guy in the NBA is Chinese, the Swiss hold the America's Cup, France is accusing the U.S. of arrogance, Germany doesn't want to go to war, and the three most powerful men in America are named Bush, Dick, and Colon. --Comedian Chris Rock

thinking

1. What will I try to improve on next week?

2. What was I most proud of this week?

3. What was my biggest accomplishment this week?

4. What have I done to get closer to my life goals this week?

5. What was hard for me this week, and why?

6. What was my biggest waste of time this week?

7. What did I do this week that made me ashamed?

Monday, April 16, 2007

Don't get Swiftfox

Don't get Swiftfox!

Swiftfox is supposed to be a processor-optimized build of Firefox. It probably is exactly what it claims to be, but nobody can really be sure. Why? Because the author refuses to release all his changes to the Firefox code base. Furthermore, he refuses to allow redistribution of his binary builds.

The Mozilla Public License clearly allows developers to release their own executables under a more restrictive license. However, when they do so they are required to release ALL source code changes under the MPL, GPL, or the LGPL. The Swiftfox developer has not done this, and instead has released only a patch which does nothing but make changes to the default preferences in Firefox.

Why does he not allow redistribution of the binaries? Because he claims that Swiftfox is more secure this way. Swiftfox would be more secure if, and only if, the developer would fully comply with the MPL, GPL, or LGPL.

Don't get Swiftfox!

At least until the "developer" starts playing nice with the Open Source community and answers the following questions:

  1. Why do you refuse to release ALL your source code changes, and instead release only a patch file?
  2. Why isn't your patch file licensed under the MPL, as the MPL requires it to be?
  3. Why do you refuse to discuss this on your forum system, and in fact ban those who question or confront you on this topic?
  4. Why should we trust the binaries of a man who does any of the above?

Friday, April 13, 2007

Drug Dealers Vs. Geeks

Drug Dealers Vs. Geeks



Drug Dealers Software Developers
Refer to their clients as "users" Refer to their clients as "users"
"The first one's free!" "Download a free trial version..."
Have important Asian connections. Have important Asian connections.
Strange jargon:
"Stick"
"Rock"
"Wrap"
"E"
"Stash"
"Drive-by"
"Hit (LSD)"
"Source"
"The Pigs"
Strange jargon:
"SCSI"
"RTFM"
"Packet"
"C"
"Cache"
"CTRL ALT DEL"
"Hit (WWW)"
"Source-code"
"Microsoft"
Realize that there's tons of cash
in the 14- to 25-year-old market
Realize that there's tons of cash
in the 14- to 25-year-old market
Clients really like your stuff when it works.
When it doesn't work they want to kill you.
Clients really like your stuff when it works.
When it doesn't work they want to kill you.
Job is assisted by the industry's
producing newer, more potent product.
Job is assisted by the industry's
producing newer, more potent products.
Often seen in the company of pimps,
hustlers and low-lifes.
Often seen in the company of marketing
people, venture capitalists and fund managers.
When things go wrong, a "fix" is just
a phone call away, but may be expensive.
When things go wrong, a "fix" is just
a phone call away, but may be expensive.
A lot of people are getting rich
while still teenagers.
A lot of people are getting rich
while still teenagers.
Product causes unhealthy addictions DOOM, Quake, SimCity, Duke Nukem 3D...
Do your job well and you can sleep with
sexy movie stars who depend on you.
Damn! DAMN!!!

Showing line numbers in Visual studio.net

A lot of people, myself included, like to see the line numbers on each line while coding. I find it easer to remember where my code is but also to use the ctrl + g (goto line number) shortcut. By default this feature is disabled but luckely it's quite easy to turn it on.


Just navigate to the menu, choose Tools | Options and this expand the Text editor node in the treeview on the left like shown in Figure 1:



Figure 1: The expanded Text Editor part


There you can choose the All languages node or the node of the language that you're interested in and check the Line numbers checkbox. Click the OK button and you have the line numbers appearing in your source view.

Thursday, April 12, 2007

Problem: Length of text, ntext, or image data (x) to be replicated exceeds configured maximum 65536.

Replication never stops to make me go crazy...every time there is something new...here is the latest bug...the column can only hold 64 KBs by default ...Run this stored procedure to increase the size...

here goes nothing

Problem: Length of text, ntext, or image data (x) to be replicated exceeds configured maximum 65536.

This message occurs when you attempt to insert into a text, ntext, or image column that is published in a replication article.


--------------------------------------------------------------------------------

Solution: Use sp_configure to increase 'max text repl size'
The default value for the maximum configuration size is only 65536. Once it's increased, the insert can proceed. To increate the size execue sp_configure on 'max text repl size'. This stored procedure does the job:

CREATE PROC usp_CONFIGURE_ReplicationSizeForBlobs

@NewSize int = 100000000

/*
* Sets the 'max text repl size' instance wide configuration setting
* that governs the maximum size of an image, text, or ntext column
* in a replicated table.
*
* Example:
**********************************************************************/
exec usp_CONFIGURE_ReplicationSizeForBlobs default

AS

print 'Old size'
exec sp_configure 'max text repl size'

print ' Setting new size'
exec sp_configure 'max text repl size', @NewSize

print 'Reconfiguring'
RECONFIGURE WITH OVERRIDE

print 'New size'
exec sp_configure 'max text repl size'

Wednesday, April 11, 2007

chehare pe mere zulf ko phailaao kisii din

chehare pe mere zulf ko phailaao kisii din
kyaa roz garajate ho baras jaao kisii din

raazo.n kii tarah utaro mere dil me.n kisii shab
dastak pe mere haath kii khul jaao kisii din

pe.Do.n kii tarah husn kii baarish me.n nahaa luu.N
baadal kii tarah jhuum ke ghir aao kisii din

Khushbuu kii tarah guzaro mere dil kii galii se
phuulo.n kii tarah mujh pe bikhar jaao kisii din

phir haath ko Khairaat mile band-e-qabaa kii
phir lutf-e-shab-e-vasl ko doharaao kisii din

guzare.n jo mere ghar se to ruk jaaye.n sitaare
is tarah merii raat ko chamakaao kisii din

mai.n apanii har ik saa.Ns usii raat ko de duu.N
sar rakh ke mere siine pe so jaao kisii din

Khud apane liye baiTh ke soche.nge kisii din

Khud apane liye baiTh ke soche.nge kisii din
yuu.N hai ki tujhe bhuul ke dekhe.nge kisii din

bhaTake hue phirate hai.n ka_ii lafz jo dil me.n
duniyaa ne diyaa vaqt to likkhe.nge kisii din

hil jaaye.nge ik baar to arsho.n ke dar-o-baam
ye Khaak_nashii.n log jo bole.nge kisii din

aapas kii kisii baat kaa milataa hii nahii.n vaqt
har baat ye kahate hai.n ke baiThe.nge kisii din

ai jaan terii yaad ke be-naam parinde
shaaKho.n pe mere dard kii utare.nge kisii din

jaatii hai kisii jhiil kii gaharaa_ii kahaa.N tak
aa.nkho.n me.n terii Duub ke dekhe.nge kisii din

Khushbuu se bharii shaam me.n jugnuu ke qalam se
ik nazm tere vaaste likkhe.nge kisii din

soye.nge terii aa.Nkh kii Khlvat me.n kisii raat
saaye me.n terii zulf ke jaage.nge kisii din

Khushbuu kii tarah ,asl-e-sabaa Khaak numaa se
galiyo.n se tere shahar kii guzare.nge kisii din

'Amjad' hai yahii ab ke kafan baa.Ndh ke sar se
us shahar-e-sitam_gaar me.n jaaye.nge kisii din

yahii bahut hai ke dil us ko Dhuu.ND laayaa hai

yahii bahut hai ke dil us ko Dhuu.ND laayaa hai
kisii ke saath sahii vo nazar to aayaa hai

karuu.N shikaayate.n takataa rahuu.N ke pyaar karuu.N
gaye bahaar kii suurat vo lauT aayaa hai

vo saamane thaa magar ye yaqii.n na aataa thaa
vo aap hai ke merii Khvaahisho.n kaa saayaa hai

azaab huup ke kaise hai.n baarishe.n kyaa hai.n
fasiil-e-jism girii jab to hosh aayaa hai

mai.n kyaa karuu.Ngaa agar vo na mil sakaa 'Amjad'
abhii abhii mere dil me.n Khayaal aayaa hai

kisii kii aa.Nkh jo pur_nam nahii.n hai

kisii kii aa.Nkh jo pur_nam nahii.n hai
na samajho ye ke us ko Gam nahii.n hai

savaad-e-dard me.n tanhaa kha.Daa huu.N
palaT jaa_uu.N magar mausam nahii.n hai

samajh me.n kuchh nahii.n aataa kisii ke
agarche guftaguu mubaham nahii.n hai

sulagataa kyuu.N nahii.n taariik jangal
talab kii lau agar maddham nahii.n hai

ye bastii hai sitam paravar digaan kii
yahaa.N ko_ii kisii se kam nahii.n hai

kinaaraa duusaraa dariyaa kaa jaise
vo saathii hai magar maharam nahii.n hai

dilo.n kii raushanii bujhane na denaa
vajuud-e-tiiragii mahakam nahii.n hai

mai.n tum ko chaah kar pachhataa rahaa huu.N
ko_ii is zaKhm kaa maraham nahii.n hai

jo ko_ii sun sake 'Amjad' to sunaa denaa
ba-juz ek baaz gasht-e-Gam nahii.n hai

shayari

na shikaayaten na gila kare
koi aisaa shaKhs hua kare
jo mere liye he saja kare
mujh he se baatein kiya kare

kabhi roye jaaye wo bepanaah
kabhi betahaasha udaas ho
kabhi chupke chupke dabe qadam
mere peechhe aa kar hansaa kare

meri qurbatein meri chaahatein
koi yaad kare qadam qadam
main taveel safar mein hon agar
meri waapsi ki duaa kare

Usey Bhool Ja....

USSeY BHooL Jaa!!!!!!


Kahan Aa K Ruknay Thay Raastey
Kahan Morr Tha Usey Bhool Ja
Woh Jo Mil Giya Usey Yaad Rakh
Jo Nahin Milla Usey Bhool Ja....

Woh Teray Naseeb Ki Barishen
Kisi Aur Chatt Pay Barus Gain
Dil Bekhaber Meri Baat Sun
Usey Bhool Ja,Usey Bhool Ja....

Main To Gum tha Teray Hi Dehaan Main
Teri Aas Teray Gumaan Main
Saba Keh Gai Meray Kaan Main
Meary Saath, Aa Usey Bhool Ja....

Kisi Aankh Main Nahin Hai Ashk-e-Gham
Teray Baad Kuch Bhi Nahin Hai Kum
Tujhey Zindagi Ne Bhulla Diya
To Bhi Muskura, Usey Bhool Ja....

Kahin Chaak-e-Jaan Ka Rafoo Nahin
Kissi Asteen Pay Lahou Nahin
K Shahed-e-Raah-e-Malaal Ka
Na Khoon Baha, Usey Bhool Ja....

Kiyon Atta Hua Hai Ghubaar Main
Zindagi K Fashaar Main
Woh Jo Darj Tha Teray Bakhat Main
So Woh Ho Giya, Usey Bhool Ja....

Na Woh Aankh Hi Teri Aankh Thi
Na Hi Woh Khaab Teray Khaab Thay
Dil-e-Muntazir To Yeh Kis Liyey
Tera Jaagna, Usey Bhool Ja....

Yeh Jo Raat Din Ka Hai Khail Sa
Usey Dekh,Us Pay Yaqeen Na Ker
Nahin Mumkin Koi Bhi Mustaqil
Sir-e-Aiyna, Usey Bhool Ja....

Jo Bisaat-e-Jaan Hi Ulat Giya
Woh Jo Raastey Se Hi Palut Giya
Usey Rokney Se Hasool Kiya
Usey Mat Bula,Usey Bhool Ja....

To Yeh Kis Liye Shab-e-Hijer kay
Usey Her Sitarey Main Dekhna
Woh Falak Jis Pay Milley Thay Hum
Koi aur Tha, Usey Bhool Ja....

Tuesday, April 10, 2007

Handy way of going back to previous page

In asp.net its much handier to have this function so that you could go to the previous page specially, if the user could reach a perticular page from a whole range of links...

I know there are a zillion ways to do this, including javascript and all...but this is my fav one...

Works most of the time.....

string sPreviousURL;
sPreviousURL = Request.ServerVariables["HTTP_REFERER"];
GoBackToPreviousPage.Text = string.Format("<a href='{0}'>Click Here to go
back to Previous Page</a>", sPreviousURL);

The only time this wont work is when a person opens the link directly in a tab...

Lemme plan and put some cases around there...

Thursday, April 5, 2007

osql Utility

osql Utility

The osql utility allows you to enter Transact-SQL statements, system procedures, and script files. This utility uses ODBC to communicate with the server.
Syntax

osql
[-?] |
[-L] |
[
{
{-U login_id [-P password]}
| –E
}
[-S server_name[\instance_name]] [-H wksta_name] [-d db_name]
[-l time_out] [-t time_out] [-h headers]
[-s col_separator] [-w column_width] [-a packet_size]
[-e] [-I] [-D data_source_name]
[-c cmd_end] [-q "query"] [-Q "query"]
[-n] [-m error_level] [-r {0 | 1}]
[-i input_file] [-o output_file] [-p]
[-b] [-u] [-R] [-O] [-X[1]]
]
Arguments

-?

Displays the syntax summary of osql switches.

-L

Lists the locally configured servers and the names of the servers broadcasting on the network.

-U login_id

Is the user login ID. Login IDs are case-sensitive.

-P password

Is a user-specified password. If the -P option is not used, osql prompts for a password. If the -P option is used at the end of the command prompt without any password, osql uses the default password (NULL).

Security Note NULL passwords are not recommended.

Passwords are case-sensitive.

The OSQLPASSWORD environment variable allows you to set a default password for the current session. Therefore, you do not have to hard code a password into batch files.

If you do not specify a password with the -P option, osql first checks for the OSQLPASSWORD variable. If no value is set, osql uses the default password, NULL. The following example sets the OSQLPASSWORD variable at a command prompt and then accesses the osql utility:

C:\>SET OSQLPASSWORD=abracadabra
C:\>osql

Security Note To mask your password, do not specify the -P option along with the -U option. Instead, after specifying osql along with the -U option and other switches (do not specify -P), press ENTER, and osql will prompt you for a password. This method ensures that your password will be masked when it is entered.

-E

Uses a trusted connection instead of requesting a password.

-S server_name[\instance_name]

Specifies the instance of Microsoft® SQL Server™ 2000 to connect to. Specify server_name to connect to the default instance of SQL Server on that server. Specify server_name\instance_name to connect to a named instance of SQL Server 2000 on that server. If no server is specified, osql connects to the default instance of SQL Server on the local computer. This option is required when executing osql from a remote computer on the network.

-H wksta_name

Is a workstation name. The workstation name is stored in sysprocesses.hostname and is displayed by sp_who. If this option is not specified, the current computer name is assumed.

-d db_name

Issues a USE db_name statement when osql is started.

-l time_out

Specifies the number of seconds before an osql login times out. The default time-out for login to osql is eight seconds.

-t time_out

Specifies the number of seconds before a command times out. If a time_out value is not specified, commands do not time out.

-h headers

Specifies the number of rows to print between column headings. The default is to print headings one time for each set of query results. Use -1 to specify that no headers will be printed. If –1 is used, there must be no space between the parameter and the setting (-h-1, not -h -1).

-s col_separator

Specifies the column-separator character, which is a blank space by default. To use characters that have special meaning to the operating system (for example, | ; & < >), enclose the character in double quotation marks (").

-w column_width

Allows the user to set the screen width for output. The default is 80 characters. When an output line has reached its maximum screen width, it is broken into multiple lines.

-a packet_size

Allows you to request a different-sized packet. The valid values for packet_size are 512 through 65535. The default value osql is the server default. Increased packet size can enhance performance on larger script execution where the amount of SQL statements between GO commands is substantial. Microsoft testing indicates that 8192 is typically the fastest setting for bulk copy operations. A larger packet size can be requested, but osql defaults to the server default if the request cannot be granted.

-e

Echoes input.

-I

Sets the QUOTED_IDENTIFIER connection option on.

-D data_source_name

Connects to an ODBC data source that is defined using the ODBC driver for Microsoft SQL Server. The osql connection uses the options specified in the data source.

Note This option does not work with data sources defined for other drivers.

-c cmd_end

Specifies the command terminator. By default, commands are terminated and sent to SQL Server 2000 by entering GO on a line by itself. When you reset the command terminator, do not use Transact-SQL reserved words or characters that have special meaning to the operating system, whether preceded by a backslash or not.

-q "query"

Executes a query when osql starts, but does not exit osql when the query completes. (Note that the query statement should not include GO). If you issue a query from a batch file, use %variables, or environment %variables%. For example:

SET table = sysobjects
osql /q "Select * from %table%"

Use double quotation marks around the query and single quotation marks around anything embedded in the query.

-Q "query"

Executes a query and immediately exits osql. Use double quotation marks around the query and single quotation marks around anything embedded in the query.

-n

Removes numbering and the prompt symbol (>) from input lines.

-m error_level

Customizes the display of error messages. The message number, state, and error level are displayed for errors of the specified severity level or higher. Nothing is displayed for errors of levels lower than the specified level. Use -1 to specify that all headers are returned with messages, even informational messages. If using -1, there must be no space between the parameter and the setting (-m-1, not -m -1).

-r {0 | 1}

Redirects message output to the screen (stderr). If you do not specify a parameter, or if you specify 0, only error messages with a severity level 11 or higher are redirected. If you specify 1, all message output (including "print") is redirected.

-i input_file

Identifies the file that contains a batch of SQL statements or stored procedures. The less than (<) comparison operator can be used in place of -i.

If input_file only specifies a file name, osql attempts to open a file with that name in the current folder. If the file is in another folder, input_file must contain the path to that folder, such as –i C:\MyFolder\MyScript.sql.

-o output_file

Identifies the file that receives output from osql. The greater than (>) comparison operator can be used in place of -o.

If input_file is not Unicode and -u is not specified, output_file is stored in OEM format. If input_file is Unicode or -u is specified, output_file is stored in Unicode format.

If output_file only specifies a file name, osql creates a file with that name in the current folder. To place the file in another folder, specify the path to that folder in output_file, such as –o C:\MyFolder\MyReport.rpt.

-p

Prints performance statistics.

-b

Specifies that osql exits and returns a DOS ERRORLEVEL value when an error occurs. The value returned to the DOS ERRORLEVEL variable is 1 when the SQL Server error message has a severity of 10 or greater; otherwise, the value returned is 0. Microsoft MS-DOS® batch files can test the value of DOS ERRORLEVEL and handle the error appropriately.

-u

Specifies that output_file is stored in Unicode format, regardless of the format of the input_file.

-R

Specifies that the SQL Server ODBC driver use client settings when converting currency, date, and time data to character data.

-O

Specifies that certain osql features be deactivated to match the behavior of earlier versions of isql. These features are deactivated:

* EOF batch processing

* Automatic console width scaling

* Wide messages

It also sets the default DOS ERRORLEVEL value to -1.

-X[1]

Disables the ED and !! commands (see descriptions of these commands later in this topic) when osql is executed from a batch file. These commands are still recognized but osql does not execute them. Instead, osql issues a warning message and continues execution of the batch. If the optional argument 1 is specified, osql issues an error message and exits.

Copied from Microsoft website... just for personal Notes..

Replication Woes continued

Well since I moved from merge to snapshot replication, i thought the problems were solved..But oh well

Here is the issue with snapshot replication...

Snapshot replication takes a snapshot of the database and replaces the existing database with the snapshot...as weird as it may seem, it does not carry the custom permissions set on the stored procedures and views to the new snapshot...

Hence, none of my stored procedures would work.

First instinct is to add the TSQL to the agent running the replication agent running the entire snapshot copy procedure...WRONG...Since the agent runs on the distribution machine, IAIDEV in my case...it runs the TSQL on the local machine and not on the remote machine...

Huh !! interesting...

So, I asked the google God and God said ..let there be command line...

hehehe...jokes apart...Now I am using the osql to run my script from the command line.

Its this handy little utility hidden inside the folder after folder...but once you get it working, it runs like a charm...

Here is what I am using finally -

I created a bat file with the following syntax to run the command on my machine
then used the windows scheduler to run the command 20 mins after the snapshot replication starts...this 20 odd mins, the remote machine would not have the correct permissions...but ah well..no one should be trying to get to my remote machine at 12 AM in the morning anyways...right ?
Besides, the wrong permissions are the lower permissions then what I give it eventually and so, there is no security hole here as well...
Anyways...back to the osql and bat file -

"[custom path]\Microsoft SQL Server\80\Tools\Binn\osql" -U username -P password -d master -i setPermissionsAfterReplications.sql

Wednesday, April 4, 2007

Replication woes

THe mistry of disappearing data rows..

On a monday morning, the last thing you would want is someone yelling abt some lost data...

Ah..may be it got deleted...may be it never got inserted...But the process has not been modified since 2004...so, why now !! what changed !!

Well as it turns out, it was the case of replication gone haywire...I had the database set for merge replication with another machine with the Live machine having 100% priority in case of a conflict so that the backup machine would only get the changes and not the other way round in case of any changes...

And guess what happened...the SQL Server conviniently decided that if the row is in a conflict its a good idea to delete it from my live machine...So, the rows of data started disappearing...

Not a good thing !!!!


Anyhu...now the database is set for snapshot replication..more time consuming but definately unidirectional...

Tuesday, April 3, 2007

Its what we call news

http://www.jibjab.com/what_we_call_the_news

Sad but true !!