Surendra Sharma

Surendra Sharma

Search This Blog

Thursday, January 30, 2014

Tech Tip on how to fix error Ambiguous column name 'Column Name' in SQL Server.

Suppose you have two tables TableA and TableB. Both these table contains ID column. Now if you are trying to access ID column as below

SELECT ID FROM TableA INNER JOIN TableB ON TableA.ID = TableB.ID 

You will get SQL error Ambiguous column name 'ID'.

Whenever you are using JOIN clause with more than one table and trying to access same field name from the table then you will get error Ambiguous column name 'ColumnName'.

How to fix it?

Solution:-

Always make sure to use table name as prefix with column name before accessing it as below

SELECT TableA.ID FROM TableA INNER JOIN TableB ON TableA.ID = TableB.ID 


Please leave your comments or share this tip if it’s useful for you.

Wednesday, January 29, 2014

How to remove Visual Studio TFS credentials for automatic logon

If you are login to TFS first time from Visual Studio then Visual studio ask user credentials for TFS.
Visual studio saved these credentials for future use.

So next time whenever you open any Visual Studio project related with this TFS, Visual Studio uses this stored credential and allow you to access projects and files.

This is great feature but problem is when another user opens the same project on same machine for same TFS. This time new user not get any authentication screen and directly logged in to TFS by using last successfully logged user credentials.

But what if new user want to login by his credentials?

Solution:-

Answer is to change credentials from Start -> Control Panel -> Credential Manager.

Credential Manager stores credentials for automatic logon in vaults so you can easily log on to computers or websites.

Credential Manager displays all stored credentials on this machine.

Just find and click IP address or link name, now either you can edit or remove credentials from vault.
Now next time if you open the TFS, Visual studio should use new credentials or ask for new credentials

This is technique works for other applications also which are asking for user credentials.


Please leave your comments or share this tip if it’s useful for you.

Monday, January 27, 2014

Creating a Scheduled Database Backup Plan using SQL Agent Jobs


This article explained that how to automate database backup process using SQL Agent Jobs

Step 1: GOTO the machine on which SQL Server is installed.


Step 2: Connect to the SQL server using SQL Server Management Studio. You need administrative access so use Windows credentials or the SA account

Step 3: Expand the Management section from the Object Explorer pane and right click on the Maintenance Plans


Step 4: Right-click on Maintenance Plans and choose New Maintenance Plan. Provide a valid name and click OK


Step 5: Double click on Subplan_1
Name: A simple name for the section of the plan (e.g. Backup)
Description: Provide some more detail explanation (e.g. Takes a daily backup and deletes the one created the previous day)

Step 6: Click on the calendar icon next to the Schedule field. Change the frequency according to requirement.


Step 7: On the left-hand (Below the Object Explorer) there will be a toolbox containing call the available tasks

 

Step 8: Add a Back Up Database Task. You can either double click it, or drag and drop it into the beige field


Step 9: Double click on the Icon to set up the backup specifications


Step 10: Specify the databases to back up. You can click on “All user databases“, or select specific ones using the “These Databases” option.

Click OK

Select the Create a backup file for every database option

Check the box that says “Create a sub-directory for each database

Select a location for the backup files.


Hit OK

Please leave your comments or share this tip if it’s useful for you.

Tuesday, January 21, 2014

JavaScript error Unable to get Value of the property 'length': object is null or undefined.

If your website is working fine but some user getting JavaScript error as “Unable to get Value of the property 'length': object is null or undefined.” Then problem is with their browser cache.

Delete browser complete history by uncheck “Preserve Favorites website data” and select rest of option as shown below as shown below





Please leave your comments or share this tip if it’s useful for you.

Monday, January 20, 2014

Tech tip for TFS error “TF203015: The item has an incompatible pending change”

If you are getting TFS error “TF203015: The item has an incompatible pending change” then follow below guidelines to fix it.

·         Un-shelve whatever you have shelve
·         While you are branching, as shown in below figure, browse your release folder and write “/V1.1” manually. Don’t create folder “V1.1” in “ReleaseFolder”, let Visual studio make it for you while branching.
·         Uncheck both the checkboxes.
·         Click on OK.




Please leave your comments or share this tip if it’s useful for you.

Thursday, January 16, 2014

“Alias is not unique error” in Sybase IQ

If you are executing SELECT statement in Sybase IQ with having same alias name of two columns as below

SELECT
      School.cCreatedBy AS CreatedBy,
      Student.cCreatedBy AS CreatedBy,
      Student.FullName AS FullName
FROM
      School INNER JOIN Student
ON
      School.ID = Student.SchoolID

then you will get error “Alias 'CreatedBy' is not unique”.

However same query run in SQL Server without any problem.

To fix this just remove alias or change alias name of any one column as below

SELECT
      School.cCreatedBy,
      Student.cCreatedBy,
      Student.FullName AS FullName
FROM
      School INNER JOIN Student
ON
      School.ID = Student.SchoolID

OR

SELECT
      School.cCreatedBy AS SchoolCreatedBy,
      Student.cCreatedBy AS CreatedBy,
      Student.FullName AS FullName
FROM
      School INNER JOIN Student
ON
      School.ID = Student.SchoolID



Please leave your comments or share this tip if it’s useful for you.

Wednesday, January 15, 2014

503 Service Unavailable for reports area of an ASP.NET MVC application


Recently I come across to strange problem where all hyperlinks are working fine in ASP.NET MVC based project except link “Reports”.  

Whenever user clicks on “Reports” link, browser shows “HTTP Error 503. The service is unavailable”.

Developers are not able to debug it. Fiddler also not showing any HTTP request / response details.

Solution:

When I analyze problem, I noted that complete URL of link “Reports” is http://abcd.com/Reports

I googled this issue then come to know that it was due to SQL Reporting services having reserved the link “Reports” for http://+:80/Reports url in http.sys.

If SQL server reporting services are installed on your machine then just try to access “http://localhost/Reports” from browser. You should get SQL Server Reporting Services Home page.

Here is the solution
·         Either changed the URL from having name Reports to some new name
·         Or try following command
netsh http delete urlacl url=http://+:80/Reports



 Please leave your comments or share this tip if it’s useful for you.