.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Mark columns as Identity in multi-table views?

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :Sql Server
Hello! When you create a view of one table (i.e. SELECT * FROM Table), it marks the table's identity column as an identity col in the view as well. I have a few that selects columns from several nested tables, but they are all related in a main identity column I select as well, but SQL Server doesn't mark this column as identity, is there a way to do it?Shimmy

View Complete Post

More Related Resource Links

How to know the number of columns displayed on the last page for Multi column table

Hi, How will I determine how many columns to be displayed on the last page of the report if I am using a Multiple column table.  I am going to use the number of columns to multiply with the width of the body of the report. I am going to use a Function to get the product. 

Cutting Edge: Creating a Multi-table DataGrid in ASP.NET


If you bind a multi-table DataSet to a DataGrid, only the first table is recognized. Here Dino Esposito writes a custom solution the the multi-table problem.

Dino Esposito

MSDN Magazine August 2003

Entity Data Model and database view returning the same columns as there are in a table


When adding a stored procedure into the Entity Data Model I can select whether the procedure returns a scalar, a (new) complex type or one of the entity types I already defined. 

How do I do something similar for a view?

I mean assuming I have a view like this

CREATE VIEW FilteredFoos as SELECT Foo.* FROM Foo join ... WHERE ...

(that is a view that implements some involved filtering, but returns all columns from one table) how do I add it to the project so that I can use the entity set, but get the Foo objects, not some new FilteredFoo objects.

var foos = myDB.FilteredFoos.Include("Bar").ToList();

foreach (Foo foo in foos) { ...

Thanks, Jenda

How to create scrolling table for columns in a SharePoint Designer Data View


I have a fairly complex SharePoint Designer 2007 Data View they have added two more requirements.

1. Have the columns on the right side be able to scroll left to right as there is a large number of columns, while the first 3 columns on the left side stay locked in place.  This is only one list not two, and because of some other requirements I have it must remain to be just one list.

2. Then they also need to have scrolling up and down of the entire list with the headers locked in place.

The first requirement is more important than the second, but preferrably I need to do both.

I am new to XSL so not familar with the syntax. Is this something I can do on a custom Data View? Does anyone have any examples of how?

I have a drawing that show how it needs to look but I don't see an option here to upload a graphic.

So here is a link to my graphic example uploaded to my blog area: http://lindachapman.blogspot.com/  or just the image here: http://4.bp.blogspot.com/_aB01ue__NvQ/TGL42MOvrGI/AAAAAAAAAA4/c3xP4uCy4BU/s1600/Scrolling.png

I failed to mention that 3/4 of the columns are HTML Calculated fields wh

SMO classes to generate alter table script to add columns

How to generate ALTER TABLE script to add columns using SMO and c#.

Fetch Identity column just after inserting a row in table

Hi, Please help me with this question. I have a table and I insert a row into it. How can i select the latest inserted row? Can the 'inserted table' keyword be used outside trigger? ( I mean can we use it in above scenario?? If yes how)   Thanks in advance Tiya

DVWP connections with multi-select lookup columns

I have a question concerning the Data View Web Part using SharePoint Designer 2007.   I have two list (A and B). List A has a lookup column (called B-items) with multiple selections to items in List B(using the Title column from B).   I create a web part page and insert a data view of using List A. I create another data view with data from List B. Next, I make a Web Part Connection between the two data views with A passing B-items column as parameter to List B data view. I then create a filter on the List B data view with a comparison of List B’s Title column equal to the parameter of List A’s B-items value when a user selects an item from List A data view. The problem is nothing appears in List B’s data view.   When I try the reverse of the above scenario it works fine.     I understand that this is properly functionality, but is there a way to achieve my first scenario? If so, how can it be accomplished?   I have looked through the web for help and found the answer here http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/749b7477-f37f-4724-94b3-b6ace770e73a seems to be what I’m looking for. However, I am unsure how to implement his code into the web part page.   I am a worse than a novice with xsl so if anyone gives an example I would greatly appreciate step by step on what code is needed a

Combining databases with Identity columns

(Using SQL Server 2005)  I have only a basic knowledge of SQL Server, but need to roll up 5 SQL databases into one database (I guess this is known as "replication"?).  These database are of similar structure and make use of an identity (or autonumber) column.  These id's are also referenced in numerous child tables.  To avoid collisions, this is my plan:   1.  turn off the identity feature of all the columns (but still keep condition of uniqueness) 2.  For each database, assign a unique range of identities (ie, db1 gets 1-500, db2 gets 501-1000, etc) and then renumber these columns accordingly.  The new id's should cascade to the child tables via the table relationships. 3.  Replicate or copy the data of all 5 databases into the new one.  There should be no collisions. 4.  Turn back on the identity feature of the appropriate columns, hopefully everything works as before. After this is done we hopefully can get rid of the 5 original databases and proceed with just one. Should this work and/or is there a better way to do this?  

wrapping a table into a multi column page

I have a table populated with some data fields that spans 5 pages.  I am trying to set up the layout to be a multi column report (just two columns) in which the table wraps at the end to populate the right section of the page How can this be done?Javier Guillen

Computed Columns in Table Variables or Table Types

I was just looking for confirmation that computed columns can or cannot be used in a @Table Variable or User-Defined Table Type. I'm trying this: declare @testtable as table(  [testcol] as case when [testcol] = '' then 'a' else 'b' end,  [testcol2] varchar(100) ); insert into @testtable select '','someval' insert into @testtable select 'c','someval2' select * from @testtable It all parses fine, but during the first insert an error is returned Msg 402, Level 16, State 1, Line 2 The data types void type and varchar are incompatible in the equal to operator. Thank you, Paul

Want to show FormView in Edit mode with specific table columns depending on their Genre??

hi, I have  a table in my database called "Profiles". This holds data on Female and Male personal characteristics. On my aspx, I have a formview in edit mode which is binded to an object data source with a GetDataByUserId Select method which retrieves data from the "Profiles" Table via a DAL. The "Profiles" table has some columns which relates to females only and some just males and some are generic to both. See example below     UserId - / of Type GUID GenreId /  of Type BOOL. Hip Size (For females) Dress Size ( For Females) ChestSize (For Men ) TrouserSize (For Men) Weight ( For both )   When the User logs in , they go to an update Page which has the Formview in Edit Item Mode and contains drop down Lists which are binded to the Users Selected Value. The DDL are in turn bound to their related table such as HIP, Dress, Chest, Trouser etc. Objective If a female user logs in I just want to show them the (Hip Size) DDL  and DressSizeDDL in the Edit item template of the formview and not the ChestSize DDL or  TrouserSize DDL. At present the GetProfileByUserId returns all colums from the table My question is how do I do this and just show DDL which are relevant to the Female or Male Only. In some cases the user may not have selected an item in the previous form so they could also be

changing table columns collations

hi i have a database with "SQL_Latin1_General_CP1_CI_AS" collation i changed it to "Persian_100_BIN" but none of columns collations is not converted to "Persian_100_BIN" and remained in "SQL_Latin1_General_CP1_CI_AS" collation. how i can change all columns collations to "Persian_100_BIN"? tank u.

DisplayCloumn From multi columns

Dear All I want to use Filed1 and Field2  as one column for display , but I do not want to override the tostring method in the class , since I want to use it in my page filter (filter1 and filter2 are the table primary key) Is there any way to accoublish that .   

Why are Identity columns automatically marked as "NOT FOR REPLICATION" for non-updateable Transactio

Hi, Replication has been a blind stop for me. I've always tried to avoid it. Anyway, I've got (non-updatable) transactional replication of data from a production database (SQL2008 R2) into a reporting database (SQL2005 SP3). There are a handful of tables with Identity columns. Looking at the Article table properties of the tables in question, I can see that "Identity Management" is set to Manual (and greyed so not changeable). Also the Identity columns of the source tables are now marked as NOT FOR REPLICATION. When I look at the replica tables, I can see that they also have an Identity on the Primary Key column. Looking at the "sp_MSins" procedures, I can see that the procedure does include the column with the Identity on it in the INSERT statement. So, having look at all this, I'm more confused that before. But, the number 1 vitally important thing for me is that the values in the Identity columns are "honoured" when replicated to the reporting database (i.e. as if I used the -E flag of BCP). And my first question is, is this the case? I've examined the data from a couple of tables, and currently it appears to be true, but I'm worried that this is just luck. Secondly, as the insert procedure includes the Identity column in the Insert (the the Identity is present in the replica), I'm assuming / guessing that the Distribution agen

To Search a word in all the columns of a Single Table

Dear Friends, How can I search a word in all the columns of a table?Please advise.

FieldTypes for Multi Text and Person or Group Columns?


i am trying to insert an Item through List Web service.

i am able to insert, Text column fields. But unable to  insert an Image in Multi text line, and inserting dates for Date column,Person or Group  fields

Please suggest me on this

 XmlDocument doc = new XmlDocument();
           XmlElement batch = doc.CreateElement("Batch");
           batch.SetAttribute("OnError", "Continue");
           batch.SetAttribute("ListVersion", "1");
           batch.InnerXml = "<Method ID='1' Cmd='New'>" +
              "<Field Name='Title'>"+strTitle+"</Field>" +
               "<Field Name='MultiTextAnnouncement'>"+Announcement+"</Field>" +
                "<Field Name='StartDate' Type='DateTime'>" + DateTime.Now + "</Field>"

Move columns in table using BIDS?



Call me crazy, but I can't figure out how to do something as simple as change the order of the columns in a report without cutting and pasting. Is there someway to reorder columns easily? Say like drag and drop like every other grid on the face of the planet supports?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend