SQL71508: The model already has an element that has the same name ABC_Role

[Origin]: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/25266466-cc27-4e60-a18f-22673e6507e8/sql71508-the-model-already-has-an-element-that-has-the-same-name-abcrole?forum=ssdt


I am trying to  convert a VS2010 database project to a VS2012 database project. This database has a case-sensitive collation. But VS2012 seems to be ignoring the collations and complains about two objects with same name (in different case) to exist, in the same project.

For example, I have 2 database roles ABC_Role and Abc_Role. In ths case sensitive project, they should be recognized as 2 different roles but VS2012 database project doesn’t seem to like it. I tried to see if the same happens with tables too. And it behaves the same way. I tried messing with “Validating casing on Identifiers” setting on the Project Settings window, but that didn’t work.

Is there a way to make SSDT recognize the collation? Any help is appreciated.

Hima, To help the community better identify relevant thread, please don’t forget to mark as answer or vote as helpful if and answer helps.

Tuesday, April 16, 2013 8:27 PM
Avatar of Hima Nagisetty
Scottrade Inc

OK, I can repro this when converting a dbproj to a sqlsproj, but not when creating a new sqlproj and adding the objects.

The problem is in the upgraded project file. Open the .sqlproj project file and make sure that the ModelCollation is set to CS, this is what was the diff for me when upgrading:


To be sure, also check that:



-GertD @ http://www.sqlproj.com

  • Marked as answer by Hima Nagisetty Thursday, April 18, 2013 8:55 PM
Thursday, April 18, 2013 8:25 PM
Puppet Lab

What is the difference between const and readonly?

[Origin]: https://stackoverflow.com/questions/55984/what-is-the-difference-between-const-and-readonly

Apart from the apparent difference of

  • having to declare the value at the time of a definition for a const VS readonly values can be computed dynamically but need to be assigned before the constructor exits.. after that it is frozen.
  • ‘const’s are implicitly static. You use a ClassName.ConstantName notation to access them.

There is a subtle difference. Consider a class defined in AssemblyA.

public class Const_V_Readonly
  public const int I_CONST_VALUE = 2;
  public readonly int I_RO_VALUE;
  public Const_V_Readonly()
     I_RO_VALUE = 3;

AssemblyB references AssemblyA and uses these values in code. When this is compiled,

  • in the case of the const value, it is like a find-replace, the value 2 is ‘baked into’ the AssemblyB‘s IL. This means that if tomorrow I’ll update I_CONST_VALUE to 20 in the future. AssemblyB would still have 2 till I recompile it.
  • in the case of the readonly value, it is like a ref to a memory location. The value is not baked into AssemblyB‘s IL. This means that if the memory location is updated, AssemblyB gets the new value without recompilation. So if I_RO_VALUE is updated to 30, you only need to build AssemblyA. All clients do not need to be recompiled.

So if you are confident that the value of the constant won’t change use a const.

public const int CM_IN_A_METER = 100;

But if you have a constant that may change (e.g. w.r.t. precision).. or when in doubt, use a readonly.

public readonly float PI = 3.14;

Update: Aku needs to get a mention coz he pointed this out first. Also I need to plug where I learned this.. Effective C# – Bill Wagner


‘The format of the specified network name is invalid’ – IIS Error 0x800704BE

[Origin]: http://www.therealtimeweb.com/index.cfm/2011/10/24/iis-error-0x800704BE

Oh don’t you just love cryptic error messages that could mean one hundred and one things? Yeah, me too.

So in the interest of some poor soul (maybe it’s you 😉 searching on this topic in the year 2142 I decided to point out what resolved this issue for me.

Background: I am running Windows Server 2008 R2 with IIS inside a Hyper-V instance. The VM was configured with a static IP and each IIS site was configured to bind to that IP, and that IP alone.
I transferred the VM to Amazon EC2 (using the ec2-import-instance API) since I wanted to move away from having to maintain my own physical hardware. Long story short, once transferred I was unable to start any of the IIS sites, they all failed with the error ‘The format of the specified network name is invalid – Error 0x800704BE’.

I knew that this error was likely related to IP bindings of some kind (EC2 usually expects you to use DHCP for IP address assignment since even an elastic IP can change) so I tried binding a few IIS sites to ‘all’ IPs. Still the sites would not start, but throw the above error.

I dug deeper and used the netsh utility (Windows commandline) to show which the network configuration for the machine, and in particular which IPs the HTTP service listens to:

netsh http show iplisten

This listed just one (the previous static) IP of my VM – this was now wrong. So I removed the binding with

netsh http delete iplisten ipaddress= (where is the actual IP that needs removing)

Next set the service up to listen to all IPs:

netsh http add iplisten ipaddress=

I then restarted IIS using


and bingo, the sites started to work.

Hope this helps someone.

IIS does not list a website that matches the launch url

[Origin]: https://stackoverflow.com/questions/10716956/iis-does-not-list-a-website-that-matches-the-launch-url

I need to debug the website i ‘m developing (ASP.NET MVC3, Razor, .NET 4, VS2010 SP1 (as administrator)) in IIS7 (Vista Home) and getting the error:

IIS does not list a website that matches the launch url.

To test if it has to do something with the settings of the app, i did create from scratch an empty new ASP.NET MVC3 website, set for IIS, created virtual directory, launched with F5 and i worked fine!

I again did create a second website project with the exact same settings (just to be sure) and this also launched as expected.

This leads my to think that i have some configuration problem!? But what? In the past i used IIS very rare, so my knowledge is somehow limited in this direction.

Any hints?


I hate answering my questions: in my question i stated that i was running VS under the administrator account. This was not true!!!

So the solution (for me) was to run VS2010 as administrator (Start->In Vista menu right click-> Run as administrator)…so simple.

As a side effect: VS2010 let me also create Virtual Directories without any problems (prior to that i got error messages stating that i have to manually adjust these)


Aggregate bitwise-OR in a subquery

[Origin]: https://stackoverflow.com/questions/3981050/aggregate-bitwise-or-in-a-subquery

Given the following table:

CREATE TABLE BitValues ( n int )

Is it possible to compute the bitwise-OR of n for all rows within a subquery? For example, if BitValues contains these 4 rows:

| n |
| 1 |
| 2 |
| 4 |
| 3 |

I would expect the subquery to return 7. Is there a way to do this inline, without creating a UDF?

WITH    Bits
          AS ( SELECT   1 AS BitMask
               UNION ALL
               SELECT   2
               UNION ALL
               SELECT   4
               UNION ALL
               SELECT   8
               UNION ALL
               SELECT   16
    FROM    ( SELECT    1 AS n
              UNION ALL
              SELECT    2
              UNION ALL
              SELECT    3
              UNION ALL
              SELECT    4
              UNION ALL
              SELECT    5
              UNION ALL
              SELECT    6
            ) AS t
            JOIN Bits ON t.n &amp; Bits.BitMask &gt; 0

I tried using COALESCE function and it works, example:


SELECT @nOrTotal = COALESCE(@nOrTotal, 0) | nValor 
    FROM (SELECT 1 nValor
          SELECT 2
          SELECT 2) t

SELECT @nOrTotal

>> Result: 3


Change Schema Name Of Table In SQL

[Origin]: https://stackoverflow.com/questions/15482838/change-schema-name-of-table-in-sql

I want to change schema name of table Employees in Database. In the current table Employeesdatabase schema name is dbo I want to change it to exe. How can I do it ?






I tried with this query:


But this gives me an error:

Cannot alter the schema ‘exe’, because it does not exist or you do not have permission.

What did I miss?


Create Schema :

IF (NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'exe')) 

ALTER Schema :


Single controller with multiple GET methods in ASP.NET Web API

[Origin]: https://stackoverflow.com/questions/9499794/single-controller-with-multiple-get-methods-in-asp-net-web-api

In Web API I had a class of similar structure:

public class SomeController : ApiController
    [WebGet(UriTemplate = "{itemSource}/Items")]
    public SomeValue GetItems(CustomParam parameter) { ... }

    [WebGet(UriTemplate = "{itemSource}/Items/{parent}")]
    public SomeValue GetChildItems(CustomParam parameter, SomeObject parent) { ... }

Since we could map individual methods, it was very simple to get the right request at the right place. For similar class which had only a single GET method but also had an Object parameter, I successfully used IActionValueBinder. However, in the case described above I get the following error:

Multiple actions were found that match the request: 

SomeValue GetItems(CustomParam parameter) on type SomeType

SomeValue GetChildItems(CustomParam parameter, SomeObject parent) on type SomeType

I am trying to approach this problem by overriding the ExecuteAsync method of ApiController but with no luck so far. Any advice on this issue?

Edit: I forgot to mention that now I am trying to move this code on ASP.NET Web API which has a different approach to routing. The question is, how do I make the code work on ASP.NET Web API?


This is the best way I have found to support extra GET methods and support the normal REST methods as well. Add the following routes to your WebApiConfig:

routes.MapHttpRoute("DefaultApiWithId", "Api/{controller}/{id}", new { id = RouteParameter.Optional }, new { id = @"\d+" });
routes.MapHttpRoute("DefaultApiWithAction", "Api/{controller}/{action}");
routes.MapHttpRoute("DefaultApiGet", "Api/{controller}", new { action = "Get" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) });
routes.MapHttpRoute("DefaultApiPost", "Api/{controller}", new {action = "Post"}, new {httpMethod = new HttpMethodConstraint(HttpMethod.Post)});

I verified this solution with the test class below. I was able to successfully hit each method in my controller below:

public class TestController : ApiController
    public string Get()
        return string.Empty;

    public string Get(int id)
        return string.Empty;

    public string GetAll()
        return string.Empty;

    public void Post([FromBody]string value)

    public void Put(int id, [FromBody]string value)

    public void Delete(int id)

I verified that it supports the following requests:

GET /Test
GET /Test/1
GET /Test/GetAll
POST /Test
PUT /Test/1
DELETE /Test/1

Note That if your extra GET actions do not begin with ‘Get’ you may want to add an HttpGet attribute to the method.