How to edit Identity specification in SQL Server 2008 - sql

I have a database in SQL Server 2008. I am unable to set Identity specification for a column CartId as shown in figure
I deleted the column and tried creating a new column and set isIdentity property but it's not working, also I deleted the table and tried creating a new table (not using query) but not able to set isIdentity property
How to fix this issue??

Data Type of column must be set to INTEGER or other numeric type.

identity property available only on numeric columns

Related

Trying to create a new column, get #1064 error

I've been using phpMyAdmin to manage my db without any problem, but today I ran into this error if I try to add any column by using the interface to any table of any database:
ALTER TABLE `testing` ADD `faaa` INT NOT NULL AFTER ;
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
But if I add the column via SQL command in phpMyAdmin, this time by removing AFTER, the column is added without any problem.
I'm still inexperience with phpMyAdmin, so I guess I must have missed a mandatory field to fill when creating a new column in the interface. Can anyone shed a light on this for me?
AFTER column_name is used to designate which column in the table you want to insert the new column after. You're providing the AFTER without telling it which column you want the new column to be inserted behind. If you don't care about the order of the columns in your table, omit the AFTER, and the new column will be inserted at the end of the column list.
You have no column name after the AFTER statement, so the phpMyAdmin doesn't know where it should be put. Whether it's you forgetting to select the column or a phpMyAdmin bug, I have no idea because for adding a new column, the only required fields are the name and type, which you have.

ASP.NET VB SqlBulkCopy String or binary data would be truncated

I'm trying to use SqlBulkCopy to upload a data table into SQL Server.
I'm getting this error:
String or binary data would be truncated.
I'm using
sqlBulkcopy.WriteToServer(dtCustom)
The SQL Server column is defined as nvarchar(50)
I changed the column to nvarchar(150) and same problem
This line is causing the problems with the import:
Enter the Location of Inspection
The line is 32 characters
If I remove "on" then it works and imports.
So what's the deal with a SQL Server table column defined as nvarchar(50) and 32 characters for data going into it?
Any ideas?
The columns have to be mapped. Even though the datatable has the same column names as the SQL table - in the asp.net vb coding you still have to do column mappings.

Difference between IsRowGUID and UniqueIdentifier

When creating a new Primary Key field, for a SQL server database in Visual Studios. I noticed that they type of the field can be uniqueidentifier. This can also be changed to nvarchar and int or bit. I also noticed though in the attributes of the field I can specify 'TRUE' for isRowGUID.
When Visual Studios creates an XSD definition automatically after importing the database (an .SDF file for this particular instance. AKA SQL compact) It automatically maps the type uniqueidentifier to the CLR type GUID. What advantages, if any, does setting the isRowGUID to true provide?
Any information or direction in this question is appreciated, as all previous efforts to gather infromation on this subject have yielded little to nothing.
Basically, rowguidcol/isrowguidcol tells SQL Server that the column is a unique row identifier much like identity does for an int column (uniqueness is enforced). It also forces a default value on the column much like identity sets the seed and increment values on an int column. Just like there can be only one identity column for a table, there can be only one rowguidcol per table.
Rowguidcol enables you to refer to, access and/or identify this column using system stored procedures. Also, SQL Server Replication can/will use the uniqueidentifier column marked as rowguidcol/isrowguidcol if available. If not, replication will add the uniqueidentifier/rowguidcol to your existing table. If you are planning on using SQL Server Replication, it might be advisable to add the column yourself as part of the design so at last you can name the column something useful.
Check out this link from Microsoft for more info ... http://msdn.microsoft.com/en-us/library/ms191131(v=sql.105).aspx

Set specific date into Default Value in SQL 2008 Server

I need to add specific date ('0001-01-01') into Default Value or Binding for date data type in sql 2008 server. So, when I adding the new record I'd like to sql set 0001-01-01 date automatically without setting this value inside sql statement from aspx script. Any help will be appreciated.
ALTER TABLE your_table
ADD CONSTRAINT [date_def_constraint] DEFAULT ('0001-01-01') FOR [your_column]

Cannot find data type geography

I'm using SQL Server 2008 R2 and I can't seem to be able to use the geography column type it's meant to have. It doesn't show up in the data type column when I create a new column and when I run this code:
CREATE TABLE [Core].[Address2](
[Geo_Id] [geography] NULL);
I get
Column, parameter, or variable #2: Cannot find data type geography.
Am I doing something wrong or do I need to enable the new data types somehow?
At the risk of stating the obvious, I'd double check to make sure the database you're using is indeed on a SQL 2008 instance.
I have found that when you add a geography column you need to restart the Management Studio in order for it to appear in intellisense. This might be the issue you are having perhaps?