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


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

want to autoincrement a character type in table

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :ASP.Net
 
For Example, "E0001" Everytime  it will automatically incremened by 1. "E0001" -> "E0002-> "E0003" and so on. "E0010" -> "E0011" and so on. "E0100" -> "E0101" and so on.  


View Complete Post


More Related Resource Links

Creating a table-valued function on a user defined type in SQL Server CLR

  
We would like to be able to create a table-valued function on a user defined type.  We would like the syntax in SQL to look like it works for the XML nodes function:   DECLARE @myXml XML = '<a><b>1</b><b>2</b><b>3</b></a>' ; SELECT  node.query('text()') FROM    @myXml.nodes('a/b') nodes (node) ;   In other words, in the FROM clause, we can access the "nodes" method of the xml variable and it returns a rowset. Thanks!

how to include a user defined table type as input for stored procedure

  
Hi ,  I have a user defined table type which i need to pass as input parameter to the stored procedure .How can i do that?

Analysis Service Oracle Number inconsistent Data Type for TABLE or Named Query

  
Dear Gurus, I'd VERY OLD PROBLEM. And I believe it addressed since 2006. When I design DataSource Views from Oracle Data Source. I found it return different oracle number data type for TABLE or NAMED QUERY   Provider Data Type Column Data Type Data Source View Data Type Oracle OLE DB Provider (OraOLEDB.Oracle.1) Table Number System.Int64   View Number System.Decimal   Named Querey Number System.Decimal Microsoft OLE DB Provider for Oracle (MSDAORA.1) Table Number System.Double   View Number System.Double   Named Query   1 System.Int64   Named Query   1.1234 System.Int64 Althought I know I can fix IT via MANUALLY EDIT DATASOURCE VIEW XML SOURCE. But I don't think this is a better solution. Is anybody have ideas ?  Wilson

Get inserted ids when inserting from User Defined Table Type

  
Imagine this procedure:   CREATE PROCEDURE [dbo].[insertActive] ( -- Add the parameters for the stored procedure here @p_data dbo.activeUpdate readonly) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. insert into dbo.active (name,stateid) select name,stateid from @p_data END How can I get the ids of the rows that have been inserted?  I tried searching the net and the forums but could not find anything. Thanks for any and all help, Gareth.

Ms sql query for this type of table structure

  
Hi This is my Table structure Field1       Filed2        001          A001          B001          C 001          D002          A003          B 003          C I need MS SQL query I need to show Field1 which has B and Not in DI mean 003 will shown coz it has B still D not comes... and 001 ,002 will not shown Coz 001 has B and D and 002 will not shown coz still it doesnt have B..Need Query... 

select 15 words(not character) from table

  

i want to select only 15 words from table  , plz reply me how can i do this???


Merge replication - table with geography data type

  

Hi,

I have a problem with geography data type replication. Any change that is done on a Geography column breaks the replication - the error message is "The Merge Agent failed because the schema of the article at the Publisher does not match the schema of the article at the Subscriber." I double checked compatibility settings that is suggested here: http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/d8e31621-5d43-48cd-bdd3-c02b8a24625c. But both publisher and subscriber are 100RTM.

I checked synchronization logs and found a strange message - attempt to convert varchar to geography. I don't understand from where the varchar data type comes from. Tables at subscriber and publisher has the same format - geometry stored in geography data type.

2010-09-20 18:36:22.499 The Merge Agent failed because the schema of the article at the Publisher does not match the schema of the article at the Subscriber. This can occur when there are pending DDL changes waiting to be applied at the Subscriber. Restart the Merge Agent to apply the DDL changes and synchronize the subscription.
2010-09-20 18:36:22.845 Category:NULL
Source:  Merge Replication Provider
Number:  -2147199398
Message: The

Correct Boolean type when designing database table?

  

In my VB.Net code I am using boolean type and it is later stored through a stored procedure to a MS SQL database table. I have so far allways been using "int" as the column type in database table because there is no Boolean type to choose from when designing the columns of a table in the MS SQL Express?


Is it correct to use the column type int for storing Boolean values?


/Kontorslokaler Stockholm


Cannot modify a column type in a table in SQL Serv 2008 Ent

  
I used ot be able to do it when the same tables were part of Sql Express: to change the column type in SSMS but now I get an error. I have never seen it before. I created a large number of table in one DB and for some reason I cannot recall, some of them ended up with int type for volume column, others bigInt. They all appear to have been created from .NET C# code not manually. Now I am getting exceptions because my code expects Int64 across the board.

This is the message that pops up when I try to save the change:

Saving Changes is not permitted. The changes you have made require the following tables to be dropped and recreated. You have either made changes toi a table that can't be recreated or enabled the option prevents saving changes that require the table to be re-created.

Apparently some option is set up wrongly in the Properties=>Options. the question is which one? I checked all Alter options and still cannot save the change.


Thanks.
AlexB

Passing array or table data type

  

I need to pass many records with number of fields(i.e 5rows and 5 columns) in either array or table form to oracle for processing. Is it possible to pass array/table from asp.net pages? If no, any solutions for this? I have been thinking of passing it as string concatenated with delimiter and split it.  Seems like it is not appropriate as i have to pass 5 strings(5rows) Any better suggestion? Thanks in advance


Am I missing something here? EF Table per Type Inheritance

  

Getting started with EF and working on getting a basic inheritance set up, but it's not being agreeable. Am I missing something here?

Tables:

-ContentItem-
ContentItemId (PK)
Title
Description
...etc

contains 2 records, let's say their ContentItemId's are 101 and 102

-Event-
ContentItemId (PK)
StartTime
...etc

contains 1 record, with ContentItemId of 101

In the VS2008 EF modeler I've done the following:

-Deleted the original relationship
-Made Event inherit from ContentItem
-Deleted the ContentItemId from Event and mapped it to the inherited value

then in the code:

        public IQueryable<Event> GetCalendar()
        {

            var all = from e in context.ContentItem select e;
            var query = from e in context.ContentItem.OfType<Event>()
                    select e;
            return query;
        }


When I break at the return statement I have 2 records in "all" and 0 records in "query"... I would expect their to be 1 record (id 101) in "query", am I missing something here?


Get the type of an index in a table

  

Hello,

Can you please take a look at the question at the following link and try to help me?

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/51af6d24-ce02-4721-b126-b8a0a7fb23c7

Thanks.


Reformatting variable character date field in custom table

  

I have a custom table with a variable character field storing a date. It is currently in the format YYYY/DD/MM plus a time stamp. I want it in the format MM/DD/YYYY without a time stamp.

I've tried a few CONVERT and UPDATE statements, with no change. The syntax is okay, and in some cases the statement has an effect (such as cutting off all but one character of the time stamp), but does not reformat the date. I've also tried resetting the fields as DATE fields or SMALLDATETIME fields in the custom table, and I receive errors after doing that.


Reformatting variable character date field in custom table

  

I have a custom table with a variable character field storing a date. It is currently in the format YYYY/DD/MM plus a time stamp. I want it in the format MM/DD/YYYY without a time stamp.

I've tried a few CONVERT and UPDATE statements, with no change. The syntax is okay, and in some cases the statement has an effect (such as cutting off all but one character of the time stamp), but does not reformat the date. I've also tried resetting the fields as DATE fields or SMALLDATETIME fields in the custom table, and I receive errors after doing that.


View data type doesn't reflect table

  

I'm not sure if this is the place for this question, but here goes.

I am running SQL Server 2005, and I've encountered an issue with view data types.  I had a client who asked if they could allow for decimals in a field that was previously an integer.  This meant going and changing the column data type on a few tables from integer to float, and changing some parameters and variables within some stored procs/functions to floats.  Somewhere the value is still being rounded down, so I queried the information_schema.columns and found about 60 views in the system that reference that column and are still being considered an int, from the tables which were already converted to float.  I've found that if I simply script the views as alter and run it the column no longer is considered an int in the information schema.

My question is this: Does this seem to be my problem, that when the view is referenced the value is changed to an int? Or does the view simply reflect the table's data type and the information schema is incorrect?  If the former, is there a faster way to update all these views without going one by one and scripting them? Thanks in advance.


TreeSelector : playing with generics and type inference

  
create a generic way to define a selection starting from a tree of objects, the most simpler way as possible.

Let's start with the beginning...
Here is a very simple little interface defining a node of the tree, basically, a value and the references to the child nodes.

Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.
Categories: 
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