Friday, May 1, 2009

Inserting excel sheet data in to SQL Server 2005 database table

1. First of all see that you have the create permissions in that database.
2. If you have the Create Permissions, Go ahead otherwise get it from DBA
3. Try to create a temporary table with the column names of the excel sheet.

    Example:

create table Temp
(
Column1 datatype null/not null,
Column2 datatype null/not null,
Column3 datatype null/not null,
Column4 datatype null/not null,
……………………… ……… like on
)

4. After creating the Temporary table Insert the excel sheet with data in to the table.
INSERT INTO Temp
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\(NAME OF THE EXCEL SHEET).xls;HDR=YES;IMEX=1', 'SELECT * FROM [sheet1$]')
GO
5. Be sure that the sheet number of the excel sheet is mentioned correctly, here it is Sheet1 but It might be different in your excel sheet and save the excel sheet in C drive.

That's it you can see the excel sheet data in table Temp.

Caged Bird

I really came to know the feelings of a caged bird or a wild animal in zoo where they are given everything and anything in the world but it lacks some thing. Same is with me. Every month my bank account is recharged for me which I say is a big amount at this stage of my life and I work in a centrally air conditioned office where temperature never drops below 22 degrees but some thing is lacking. I never enjoyed my coffee as much as I did in my college canteen with my friends. I was never fed up using the computer as I was now. I never enjoyed sitting on this ergonomic chair than I did sitting idle at bay area in Vizag watching nothing but waves. I am well connected to the world through phone where I can call any part of the world absolutely free but never felt like calling anyone. I am fed up .fed up with anything and everything.

Coming to my life last week was full of learning experience to me about life. I myself surrendered to my manager and I took up new project which I was delaying for the last one year so that literally they can cut the resource as I will be handling two applications. I am in AMDO dept. which stands for Application Maintenance and Development Operations. I came to know what pressure can do with humans and how it yields results. One single word I speak with my manager after he speaks a lot with me “OK I WILL DO IT…MAIL ME THE DETAILS”. I never extended my conversation much more than this. Not even a Hi or at least a Bye.

OK I want to write a post on Human Infrastructure. Watch out for it and last thing my blog stats showed one day highest hits as 113. Donno who is watching me?

Fools Follow Rules

Today I was talking to one of my colleague, less colleague and more like a brother where he quoted this line fools follow rules. First of all I have a bad opinion about rules which I came across almost every part of my life and fed up with them. A perfect example of being fed up with them is having a professional look. In my school days we are asked or forced to wear mono color shirt, mono color trouser, a small tie rather I would say a thin tie and black shoes till Thursday and full white on Friday I donno why we wear full white on Friday like a nun. white shirt white trouser and white canvass shoe which I like it very much because I wear it only once in a week and my point here is I was forced to wear this type of attire and I developed a negative feeling towards that and now in my professional life it is very common for to people come in with nice shirt, cool trouser and formal shoe with in shirt. I like this format very much but since it is a rule or say company policy I do not want to follow it, though I like it. Alas fools follow rules.

Very busy in office working 14 hours I mean to say I am spending 14 hours in office either working or not, total 3 hours work out started weight training also and I should confess I would have been in good shape if I had a control over diet and my weekend food is of high calories one.

Gotta go…need to send some reports.