Data is displayed with different styles in the same column SQL - sql

I am Working with Microsoft SQL Server Management Studio.
All values in my table are displayed, after I have made an INSERT INTO in the column BA (NVARCHAR (31)), in order to fill in missing values. They are displayed in a different format than the already existing values.
I already tried ALTERING the column to a different datatype (float) but it did not help either.
I expect the output of for example '5001100016' instead of '5.0011e+009'
Thanks for your help, I am very new to SQL

Related

SQL Convert from alphanumeric to numeric only

Ok, I have a table I am querying for an outside project. The table has a field that is alphanumeric but the external project can only support numeric data. The outside project is needing my data as an Excel spreadsheet so I am trying to just export my query to Excel which I can do but I can't seem to figure out if there is a simple convert feature to do this for me. The originating table has the field as VARCHAR(10). I tried CAST and CONVERT but no go. This is SQL Server 2012.
Thanks.

Server 2012 R2 SQL Database Change Column From ntext to nvarchar

I have a predefined SQL data base that we have to work correctly with a reporting software we have purchased. When ever we pull a column of data with the reporting software we get system.indexoutofrangeexception error. On the first table we replaced all Semi Colons ';' with space within the data and this corrected the issue. This column does not have any other special characters within the data only semi colons.
However the data in the second column we need to query contains all different kinds of characters that are probably invalid. The column type is ntext and would like to either change the data directly in the sql database everytime there is a new entry or would changing the format to nvarchar(max) or nvarchar(1024) be suffice?
Thanks for the support I am beyond green at sql.
Your problem is most likely not related to the datatype in your database but the data itself.
Your reporting software seems to have specific requirements that your data does not meet.

Datatype for a column with both numbers and text in SQL Server?

I am exporting data from Excel to a SQL Server table using SSIS. I have a column in Excel which contains numbers and text.
What is the best datatype that I could use in the created table in SQL Server for this column to make the export of data smooth?
The reason that I am asking this is because I tried the data transformation and only the data with numbers in the above mentioned column got loaded properly.
BTW I used nvarchar(255) for the above column.
Thank you
Edit: My table kind of looks like this
The rows with text in col3 and col4 are not copied into the table
If your excel column contains combined values of characters, numbers and alphanumeric, add IMEX=1 to the extended properties of excel connection manager.
https://www.youtube.com/watch?v=s3d-XIYuB7k
Thanks

"Error validating formula" when adding Computed Column with CONVERT(DATE, column)

I am trying to add a computed column to a table via SSMS - I'd rather care not to get into the details on why the base column is a VARCHAR(10) and not a DATE and no, I'm not interested in changing it.
When I enter the formula CONVERT(DATE, [charDob]) in the table designer SSMS reports:
Error validating the the formula for column charDobTyped.
Using the formula [charDob] "works" as expected, meaning the column is bound correctly. Also the formula CONVERT(DATE, '2001') "works" as expected - so there is something with using the column that is causing the error.
The original column is a VARCHAR(10) and contains NULL values or values that are otherwise convertible to DATE. The query SELECT CONVERT(DATE,charDob) as dob FROM people works as expected. Also, the error message is about "invalid formula" and not about a data conversion error, so I don't believe that inconvertible is causing this.
I have already saved the table with the new computed column and a dummy value and reconnected to the database - this was to ensure that there was not an odd caching issue occurring, as sometimes occurs. The error persists independent of the persisted flag - if only it were that easy to turn off.
Management Studio is not the best way to perform most DDL. Please open a new query window and use:
ALTER TABLE dbo.whatever ADD newcolumn AS (CONVERT(DATE, CharDob));
Here is the specific bug:
http://connect.microsoft.com/SQLServer/feedback/details/291134/katmai-table-designer-cant-validate-computed-column-formula
"Next release" in this context is most certainly SQL Server 2012, so if you are using 2008 or 2008 R2 SSMS (why?), the fix won't apply to you.

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?