SQL Problems n Tips - Sajha Mobile
SAJHA MOBILE
SQL Problems n Tips
Posts 26 · Viewed 9537 · Go to Last Post
rawbee
· Snapshot
Like · Likedby · 0

Hey Sajha guys,

This thread is dedicated to all SQL professonals/Learners where we can discuss about SQL problems. you can post any tips related to SQL. Hopefully you guy will post ur poblems n tips to share with other sajha pps

thanks

Load Previous
techGuy
· Snapshot
Like · Liked by · 0

Great Job rawbee!!

Hey guys, I know this thread is not meant for this, but if u guys really want to start learning from scratch follow this link, its really helpful. This is for the beginnners.

http://www.w3schools.com/sql/default.asp

rawbee
· Snapshot
Like · Liked by · 0

Khusbhu am gonna post some begining vedio tutorial this weekend.

and thanks for techguy. really appriciate for ur support.

keep posting....

cyberdude
· Snapshot
Like · Liked by · 0

some other small tip for starters are

NULL is not equal to '' (blank)some time you save '' in your rows thru apps and web apps so to help with that try

SELECT * FROM SOMETABLE WHERE ISNULL(COLUMNNAME, '')<>''

i like to play with isnull a lot
lets say u have a proc with @value1 int=NULL lets say you want to filter the rows when the @value1 is not null

fastest way to do this is

SELECT * FORM SOME TABLE WHERE ISNULL(@value1, COLUMNYOUWHATTOFILTERBY)=COLUMNYOUWHATTOFILTERBY

similarly another ISNULL trick to substitute CASE is

lets say you have a query

SELECT
     COLUMN1,
    CASE COLUMN2 IS NOT NULL THEN
          COLUMN2
     ELSE
           COLUMN3
     END AS SOMECOLUMNNAME

You can do the same with

SELECT COLUMN1, ISNULL(COLUMN2, COLUMN3) AS SOMECOLUMNNAME

 

rawbee
· Snapshot
Like · Liked by · 0

Thanks Cyberdude..keep posting ur tips...\

TIPS : How to backup database with datetimestamp in file name?

USE master;

DECLARE @FileName NVARCHAR(1024)

SET @FileName = 'F:\data\AdventureWorks2008\backup\AW2008'+REPLACE(REPLACE(CONVERT(varchar(100), GETDATE(), 100),':','_'),' ','_')+'.BAK'

SET @FileName = REPLACE(@FileName,'__','_')

PRINT @FileName

BACKUP DATABASE AdventureWorks2008 TO DISK = @FileName WITH NOFORMAT, INIT, NAME = N'AdventureWorks2008-Full Database Backup'

GO

Is that helpful for you????????

Continue..............

rawbee
· Snapshot
Like · Liked by · 0

Tips :How to count Sundays between two dates?

USE AdventureWorks

DECLARE @StartDate DATETIME, @EndDate DATETIME

SET @StartDate = '2009-01-01'

SET @EndDate = '2010-06-01'

SELECT Sundays=COUNT(*)

FROM (SELECT TOP (DATEDIFF (DAY, @StartDate, @EndDate) +1)

[Date] = DATEADD(DAY, ROW_NUMBER()

OVER(ORDER BY c1.name, c2.name), CONVERT(char(10),@StartDate-1,110))

FROM sys.columns c1

CROSS JOIN sys.columns c2) x

WHERE DATEPART(dw,[Date]) = 1;

 

Result:

Sundays
74

 

Continue...................

sumansuman
· Snapshot
Like · Liked by · 0

रवी त खतराको SQL गुरु रहेछ यार।

 

Last edited: 20-May-08 11:46 AM
rawbee
· Snapshot
Like · Liked by · 0
hehe  suman2 . testo खतरा ni chhunia just working this fields from couples of years. so just sharing my experiances and trying to get some tips from others too.....
rawbee
· Snapshot
Like · Liked by · 0

Hello guys,

Sorry for unable to post video turotrials last weekend. actually those file are in WMV and huge in size. I am trying to convert into another format but dint get any free software for that. Do you guys have any idea for those software that converts WMV file and can split files?

stylish
· Snapshot
Like · Liked by · 0

Hi rawbee,

Its nice you have started the thread for SQL tips..really good.. I am a beginner and wanted to work as a DBA rather than a developer coz i dont have dev skills.. but want to learn. I know all the things like scipts all the things but the problem is like i have no confidence in writing scripts or you can say i do not know to create logics.. Can you give me tips what kind of job will be there and what you have to do?? Your project experience I mean....

Thanks

acbel44
· Snapshot
Like · Liked by · 0

Stylish:

It is always good to start with Developer. I started my career as a BA and then Oracle Dev/DBA and then now in both SQL and Oracle.

there are few standard things that you have to do as a DBA:

1. Writing Scripts such as restore db, backup db, sps to generate reports of several jobs in the server, script to monitor the performacne of the database, finding size, growth of the databases to find the bottlenecks, and etc.

2. SPs and sheel script to maintain, manage and tune the database.

3. Backup the DBs.

4. Restore the DB.

5. Check the jobs every day to make sure they are running properly and fix them if failed..

6. Make database up and running.

7. Tune and optimize the database.

 

These are standard jobs i do as a DBA. There will be a whole list.

Let me know if you have any specific questions from Database perspective, i will be more than happy to answer or help you out whatever i know. Thank you and good luck

 

rawbee
· Snapshot
Like · Liked by · 0

stylish ji:

Yes I agree with acbel ji. Lots of guys think DBA is easier then Developer  considering only using GUI tools and wizards, in fact it’s true in some way but when you get real problems in DBA, you have to solve it immediately but as far for Developer they get certain deadlines for specific task. And DBA jobs are more responsible and risky job too.

 

If you have developer experience you can move into DBA easily DBA-Dev is not so easy. In MS SQL the main Tasks are:

  • Installing and upgrading SQL Server
  • Monitoring the database server's health and tuning it accordingly
  • Using storage properly
  • Backing up and recovering data
  • Managing database users and security
  • Establishing and enforcing standards
  • Performing data transfer
  • Setting up and maintaining data replication
  • Setting up server scheduling
  • Providing 24-hour access
  • Working with development teams

But if you chose as MS SQL developer you have 3 major fields make you carrier:

-         Report Developer

-         ETL(Integration service) developer

-         Data Analyst

 

The main Responsible for developer as vary on their job but basically the following main tasks are:

-         Write a function and store procedures.

-         Quarry tuning

-         Develop , maintain and deploy packages(for ETL dev)

-         Develop , maintain and deploy Cubes and dimension (for Analyst)

-         Develop , maintain and deploy Reports( for Reporter)

 

I would suggest you go for reporting. Its best way to start of SQL developer. And job market for Report developer is really good.

 

So all the best….

 

sumansuman
· Snapshot
Like · Liked by · 0

साथीहरु प्रती घण्टा कती पाउनु हुन्छ SQL सर्भरको जागिरमा? म आहेले प्रती घण्टा $३५.00  मा काम गर्दै छु। आहेले बजार तेती राम्रो छैन। तीन बर्ष अगाडि मैले $४५.00 पाएको थिए। 
.....................................................................................

सुमन अनवर सुमन

acbel44
· Snapshot
Like · Liked by · 0

suman, are you sure are you working on $35? If you are a DBA(Production Support) this is way too less. I do not want to say how much i get but the billing rate for the DBAs (SQL or Oracle or Sybase), should be more than $70 ( at least 70). Market is good as far as i know.

Any way good luck and if you guys want to know each other, contact me in here in Sajha and we will do formal chinjan.

Life is SQLized dudes....

rawbee
· Snapshot
Like · Liked by · 0

if you going thro dhoti consultancy ur range will be $30-40 without realtime experiance but if you find by urself ur range will be $60-80depending upon ur experiance...

 

sumansuman
· Snapshot
Like · Liked by · 0

SQL Server Release History
Version Year Release Name Codename
4.21
(WinNT)
1993 SQL Server 4.21 -
6.0 1995 SQL Server 6.0 SQL95
6.5 1996 SQL Server 6.5 Hydra
7.0 1999 SQL Server 7.0 Sphinx
- 1999 SQL Server 7.0
OLAP Tools
Plato
8.0 2000 SQL Server 2000 Shiloh
8.0 2003 SQL Server 2000
64-bit Edition
Liberty
9.0 2005 SQL Server 2005 Yukon
10.0 2008? SQL Server 2008 Katmai

सुमन अनवर सुमन

Last edited: 21-May-08 02:58 PM
Last edited: 03-Jun-08 01:51 PM
Last edited: 03-Jun-08 01:58 PM
smileypkr
· Snapshot
Like · Liked by · 0

launa malai ta install garna nai aayana ki kya ho. i am trying to install sql server 2005 express and i think i almost installed it but could not be able to see the sql window.

 

once i installed, i click start-sql server 2005-configuration too- sql server configuration manager

aba k garne.

Last edited: 01-Jun-08 05:51 PM
stylish
· Snapshot
Like · Liked by · 0

Hi rawbee and acbel44,

Thanks for the tips. I am gonna learn now seriously..

 

rawbee
· Snapshot
Like · Liked by · 0

lets start sharing your porblem and tricks in SQL once again.....common sajha guys

check out some of my collection articles and tricks

http://rawbeez.livejournal.com/

prankster
· Snapshot
Like · Liked by · 0

Category :Problem

 

I'm getting "No more data to read from socket" error. It happens on only one DB server. Tried the same on other servers..takes time, but atleast returns data.

Previously, we had to reboot the server and it worked fine for sometime, but now even if we reboot it, no use.

Any idea?

Oh yeah, its Oracle.

rawbee
· Snapshot
Like · Liked by · 0
guys any Oracle exports??? pls help prankster
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 77 · Viewed 18443 · Likes 16
· Posts 1 · Viewed 101
· Posts 1 · Viewed 107
· Posts 1 · Viewed 265
· Posts 16 · Viewed 3530 · Likes 3
· Posts 1 · Viewed 221
· Posts 1 · Viewed 343
· Posts 6 · Viewed 931 · Likes 1
· Posts 1 · Viewed 176
· Posts 1 · Viewed 184



Your Banner Here
Travel Partners
Travel House Nepal