Advise On Column Type

Jan 2, 2007

Hello,

In my web application I am listing steps of action:
STEP           ACTION
10  
10.1 
10.2
10.9
10.10
10.20
30
30.1
etc

How should I set up my columns in my database?  I tryed decimal but the problem is that 10.1 and 10.10 is in theory the same while in my case it is absolutely not. I also tryed nvarchar but does not sort correctly.
Should I create 2 int column, one for the main step and another one for the sub-step  (one would contain the part before the "." and the other would contain the part after the ".")?

Thanks

View 4 Replies


ADVERTISEMENT

Advise On Multiple Column Updates

Jul 20, 2005

Using SQL2000, is there another way of optimizing the original query below.TIA,BobUpdate Transactionset field1 = (select (sum(tax)-sum(credit))/sum(credit) from tblOrder wheretblOrder.id = Transaction.id),field2 = (select avg(price) from tblOrder where tblOrder.id =Transaction.id),field3 = (select min(cost) from tblOrder where tblOrder.id = Transaction.id)etc..(there are six additional updates)Is this a quicker way:Update TransactionSET field1 = (sum(tax)-sum(credit))/sum(credit) , field2 = avg(price) ,field3 = min(cost) , etc.....FROM tblOrderWHERE tblOrder.id = Transaction.id

View 1 Replies View Related

Bulk Insert Task Failing On Data Type Conversion For A Destination Column Of Type Bit

Jul 6, 2006

I am trying to use the Bulk Insert Task to load from a csv file. My final column is a bit that is nullable. My file is an ID column that is int, a date column that is mm/dd/yyy, then 20 columns that are real, and a final column that is bit. I've tried various combinations of codepage and datafiletype on my task component. When I have RAW with Char, I get the error included below. If I change to RAW/Native or codepage 1252, I don't have an issue with the bit; however, errors start generating on the ID and date columns.

I have tried various data type settings on my flat file connection, too. I have tried DT_BOOL and the integer datatypes. Nothing seems to work.

I hope someone can help me work through this.

Thanks in advance,

SK



SSIS package "Package3.dtsx" starting.

Error: 0xC002F304 at Bulk Insert Task, Bulk Insert Task: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.The bulk load failed. The column is too long in the data file for row 1, column 24. Verify that the field terminator and row terminator are specified correctly.Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 23 (cancelled).".

Error: 0xC002F304 at Bulk Insert Task 1, Bulk Insert Task: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.The bulk load failed. The column is too long in the data file for row 1, column 24. Verify that the field terminator and row terminator are specified correctly.Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 23 (cancelled).".

Task failed: Bulk Insert Task 1

Task failed: Bulk Insert Task

Warning: 0x80019002 at Package3: The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

SSIS package "Package3.dtsx" finished: Failure.

View 5 Replies View Related

How Can I Set Constant Padding Between The Columns Of The Column Chart(stacked Column Sub-type)?

Aug 2, 2006

Hi All,

I am working on a column chart type (stacked column sub-type) report.

Our customer requires us that the space(padding) between the columns should be a constant(including the space between the Y-axis and the first column). I know how to set the width of the columns, but I really don't know how to set the width of the space between them. The columns just varies the space between them automatically according to the number of the columns (the number of the columns is not certain).

Thanks a lot in advance!

Danny





View 2 Replies View Related

TSQL - Using ALTER TABLE - ALTER COLUMN To Modify Column Type / Set Identity Column

Sep 7, 2007

Hi guys,
If I have a temporary table called #CTE
With the columns
[Account]
[Name]
[RowID Table Level]
[RowID Data Level]
and I need to change the column type for the columns:
[RowID Table Level]
[RowID Data Level]
to integer, and set the column [RowID Table Level] as Identity (index) starting from 1, incrementing 1 each time.
What will be the right syntax using SQL SERVER 2000?

I am trying to solve the question in the link below:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2093921&SiteID=1

Thanks in advance,
Aldo.

I have tried the code below, but getting syntax error...



ALTER TABLE #CTE
ALTER COLUMN
[RowID Table Level] INT IDENTITY(1,1),
[RowID Data Level] INT;


I have also tried:

ALTER TABLE #CTE
MODIFY
[RowID Table Level] INT IDENTITY(1,1),
[RowID Data Level] INT;







View 18 Replies View Related

Column Type

Jul 20, 2005

I am putting together a SQL table which will hold a latitude andlongitude for each record. An example of a latitude is: 47 05 36.5Which column type would best represent this and retain the spacesbetween degrees, minutes, seconds? Text, varchar, char?ThanksJeffJoin Bytes!

View 3 Replies View Related

Mofify Column Type

Jun 20, 2008

hi
i am trying to modify a column type from smallint to nvarchar(10), i am using the following script :
ALTER TABLE Addresses MODIFY [Floor] NVARCHAR(10)
i am getting :
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'Floor'.
what is the problem with that?

View 1 Replies View Related

Column Data Type

Jun 17, 2005

Hello,  I would like to get the columns in a table, this works fine:SELECT syscolumns.* FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id WHERE sysobjects.name = 'Customers'ORDER BY syscolumns.colidHowever, is there a way to get Column_Data_Type as for example "nchar" or "varchar" instead of having it as numbers.Can anybody help ?thanks

View 7 Replies View Related

*unsigned* 32-bit Column Type?

Aug 1, 2004

I need to stored lots of unsigned 32-bit values. (I'm actually storing IPv4 addresses). These values will frequently exceed 2^31 but never exceed 2^32

My options are:
Use bigint. This is undesirable since this wastes 32-bits of space for every value.
Use int and use the negative value range to get full 32-bits worth of data. In C, it is easy and fast to cast a signed -1 to an unsigned 2^32-1. In SQL, it will be more expensive: Must cast to 64-bit and if val < 0 then val = 2^32 + val.


Is there a better alternative?

Is there a fast (binary) way to cast a value > 2^31 to a negative signed value?

DECLARE @value BIGINT
SET @value = 3000000000

SELECT CONVERT(INT, @value) -- causes error
SELECT CAST(@value AS INT) -- causes error

View 14 Replies View Related

Asking For Column Data Type

Feb 11, 2004

This is an easy one , I need to know the way to check programatically for an SQL server 2000 column data type , if the result is a code , which codes are for the diferent datatypes ( varchar , text , smallint , etc ) , if you send me an url is ok.

thank you

View 2 Replies View Related

Sum Of Column Of Blob Type

Apr 10, 2007

I have a column in my table that is an Image (blob). The data storedin this blob is basically pdf files. I need a query to determine thetotal size of these blob's in the database. Here is what ishappening, if I run it as below I get 23736000 for a result.select sum(datalength (cast(document AS binary(8000)))) fromplan_reportIf I run it like this select sum(datalength (cast(document ASvarbinary(8000)))) from plan_reportI get 23736000 also as a resultIf I run it like this select sum(datalength (cast(document ASvarbinary))) from plan_reportI get 89010 this as a resultIf I run this: select datalength(document) from plan_report then Iget a result for each row and when I sum those rows I get 5584452854this as a result.I do not believe the first 3 queries are returning correct result setsdue to the limit on the fields (binary/varbinary) and since this is animage field I cannot convert to anything else.....I am out of ideas, and any help you can give me will be greatlyappreciated...

View 4 Replies View Related

Alter Column Type.

Jul 20, 2005

Hello,Easy one for the SQL experts.I have a simple table. For the example let's say it looks like this:CREATE TABLE doc_exb ( column_a INT, column_b VARCHAR(20) NULL)Now I want to alter this table and make the column column_a a floatinstead of an INT.How do I do that? I cannot DROP and ADD the column I would lose somevery precious data.Thanks a lot

View 1 Replies View Related

Find Type Of A Column

Jan 30, 2007

hi

is it possible to find a column's type inside stored procedure?? I am going to get the name of the table and then work with the columns and I just need the type of the column if I have had the name of it

regards

View 1 Replies View Related

Getting The Column's Data Type

Mar 10, 2008

Hi,
I'm trying to figure out the best way to determine the data_type of a column, given the table name and column name. Once I've determined it's a charactor string I can get the length using COL_LENGTH, but I can't fund a command or procedure that will return the data type.


Thank you.

View 1 Replies View Related

Column Type For Images

Oct 4, 2007



I was creating a table using MS SQL Server CE using Orcas development environment->Datasources interface. In the list of columns, I couldn't see column type 'Image'. Is there any way I can create a table in CE with column type as 'Image'?

View 1 Replies View Related

Advise Please

Aug 9, 2007

helloI have two related tabletable1cIdcDesctable2IdNamephonecIdThese two tables are relatedwhere cId in table 1 is primary key and cId in table2 is foreign keyIf I want to delete a record in table 1 which is related to table 2Which is faster and more accurateshould I write my stored procedure like thisif exists(select * from table2 where cID = @CID)delete from table1 where cID = @CIDelsereturn 0------------------------------------------or------------------------------------------delete from table1 where cID = @CIDif @@error<>0return 0

View 14 Replies View Related

Please Advise!!!

Feb 7, 2005

Hi there!!

I just want to ask one question and i am looking for advice or recommendation.


I want to make an application using windows application in .NET. this application is only to have one or two users to enter details of clients on the database using the application and it will be a search for client name or number and other search methods which is similar.

My question now, what database shall i use for this kind of application SQL server or MS Access. i am looking for a new product to use as the cleint can not afford expensive software. Please advise!! thanks!!

View 3 Replies View Related

Advise: DTS

Jul 20, 2005

Version: SQL Server 7.0App: MS Access 2000I created DTS to move records from MySQL to SQL Server (approx over 500,000+per months dataset) for purpose of canned and adhoc reporting. The apphave a simple interface using MS Access where user will input the timeframeof the dataset they will process.Both servers are physically located in the same bldg from another state.Previous to MySQL, they send us cd in text format and my app runs the DTSusing a BAT file containing the DTSRUN command. But I would like stay awayfrom the DTSRUN since they take awhile to load to the server, plus it runson background on client pc. I wanted a functionality where it will run onthe server without user supervision, and they can go about their businessand do something else. In other words, let the server do majority of thework.Now that MySQL came into the picture, the Network Support created a filedsnwhere sqlserver sits and I use that as a reference on my DTS (using UNC,\myserverfile$sample.dsn)The problem:1) I work from home and when creating and running this DTS's, it takes awhile to process;2) When specifying the UNC path on DTS and saved, for some reason itswitches to the User/System DSN section;3) I also tested from office with the same result (i connect using cablemodem)Now the only way I can think of to solve this problem:a) save the DTS as a file and send it over to Network Support and have themload it up and manually change the source location OR have them modify theDTS and change the source locationb) then create a DTS jobThe person who will be running this DTS might be running it from home oroffice. Also, is there a way to automate the DTS job using an SP? I wantedto make it as easier as possible for the end user, where all they have to dois enable the job and run only for this time and for this package.TIA!Bob

View 1 Replies View Related

Pls Advise Me. HELP Pls...

May 20, 2006

on the 1st opening of my web page it uses the membership control of asp.net
for logging on. sometimes it takes time to logon and worse is, it will
encounter sql server error. that can be resolved by just restarting that
specific page and it will be alright, it will logon normally. this only issue happens only on the first opening of the logon page.
i have read a certain article and it says there that on the first time
you access the sql server, sometimes the sql server needs a little more
time communicating back and forth.
how can i make my log-on page wait a little longer till it communicates
or finishes communicating to the sql server?
im afraid that this may happen once i deploy my web project. i am
expecting over 100 users and they might save to the database all
together. will i encounter problem on this particular?
i am using ASP.NET 2.0 and SQLExpress for this project. pls advise me.
BIG THANKS.

View 11 Replies View Related

SQL Change Column Data Type

Aug 20, 2007

How do I programatically  change a column (say username) in a table (say tblusers) from varchar(25) to varchar(100)I am looking for something likealter tblusers set username as  varchar(100) I know the above statement in nonsensical but it conveys the idea. 

View 3 Replies View Related

SQL 2005: Using LIKE With Column Of Type Text

Sep 19, 2007

Hi,How do we use like when we have a column of type TextSelect * from where myColumn LIKE 'prefix%'where myColumn is of type Text in SQL server 2005Thanks.

View 1 Replies View Related

ACCESS SQL COLUMN DATA TYPE

Oct 19, 2007

HELLO
i have an sql server database, with a table an some columns.
how can i get the data type of each column and the lengh define in the database table?
 

View 4 Replies View Related

Changing Column Data Type

Nov 23, 2007

I want to change a column's data type from bit to int.  There are data in the table already.  I'm wondering if it is save/correct way to issue the following command to change the data type for that column.ALTER TABLE database_tableALTER COLUMN my_bit_column INT; Thanks.

View 1 Replies View Related

How To Add Newline In Column Of Type Nvarchar

Nov 7, 2005

Hi, I want to add a newline in a content of sql column (using t-sql and not asp.net textbox) so when content is being rendered in a .net textbox I get separate rows, so insteadcol1 col2 col3 I woule like to havecol1col2col3Thanks

View 3 Replies View Related

Inserting In An Image Type Column

Aug 10, 2004

Hello, I was wondering, how do I insert a file in an Image type column from the SQL server 2000 corporative administrator? I have a table that contains information about all the programs we run here, and I have a column that I set to image type, I want to put the icon of my programs there..

View 5 Replies View Related

Asterisk In Nvarchar Column Type

Apr 1, 2014

Is it ok/possible to use and * in a column that is NVARCHAR type?

View 4 Replies View Related

SQL 2005: Using LIKE With Column Of Type Text

Sep 19, 2007

Hi,
How do we use like when we have a column of type Text

Select * from where myColumn LIKE 'prefix%'

where myColumn is of type Text in SQL server 2005

Thanks.
__________________

View 3 Replies View Related

Rename A Column And Its Data Type

Feb 27, 2008

What is the way to rename a column in a table along with its datatype.


Thanks

View 2 Replies View Related

Need Query For Modify Column Type

Mar 10, 2008

Hello Experts,
Can any one tell me the query to modify the existing Column character length using QUERY?

View 6 Replies View Related

Temp Table Column Type?

Aug 24, 2006

can anyone help me figure out why when i run the following storedprocedure i get the error:(1460 row(s) affected)Msg 245, Level 16, State 1, Procedure SP_SALESTRENDS, Line 40Conversion failed when converting the varchar value 'X' to data typeint.SP:--STORED PROCEDURE FOR INVOICE TRENDS:--To use Stored Procedure use the following code:--EXEC SP_INSPECTIONSUMRY (MONTH), (OFFICE)--(OFFICE) CAN BE: BGR FOR BANGOR, SP FOR SOUTH PORTLAND, NH FOR NEWHAMPSHIRE, UNH FOR UNH--(REPORT) CAN BE: PRODUCT CODE FOR REPORT BROKEN OUT BY PRODUCT CODE-- EXEC SP_SALESTRENDS BGR, INVOICED, 2006, XALTER PROCEDURE SP_SALESTRENDS@OFFICE VARCHAR(30),@REPORT VARCHAR(30),@VARYEAR INT,@CODE VARCHAR(30)ASIF @REPORT='INVOICED'SELECT YEAR(I.INVOICEDAT) AS VARYEAR, MONTH(I.INVOICEDAT) AS VARMONTH,SUM(I.STOTAL) AMOUNT, P.PERSON, P.PRODUCT, C.DESCRIPTNINTO #TEMP_SALESTRENDSFROM OPENQUERY(PROJECTS, 'SELECT PROJECT, INVOICEDAT, STOTALFROM INVSUMYR') ILEFT JOIN(SELECT *FROM OPENQUERY(PROJECTS, 'SELECT NUMBER, PRODUCT, PERSONFROM PROJMAST')) PON (LTRIM(I.PROJECT)=LTRIM(P.NUMBER))LEFT JOIN(SELECT PC, DESCRIPTNFROM OPENQUERY(PROJECTS, 'SELECT PC, DESCRIPTNFROM PRODCODE')) CON (C.PC=P.PRODUCT)GROUP BY YEAR(I.INVOICEDAT), MONTH(I.INVOICEDAT), P.PERSON, P.PRODUCT,C.DESCRIPTNORDER BY VARYEAR, VARMONTH-- INVOICED REPORT BROKEN OUT BY OFFICEIF @REPORT='INVOICED' AND @CODE=1 AND @VARYEAR=1234 AND@OFFICE='NORRIS'SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSGROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @CODE!=1 AND @VARYEAR=1234SELECT VARYEAR, VARMONTH, SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT=@CODEGROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED'AND @CODE!=1 AND @VARYEAR!=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT=@CODE AND VARYEAR=@VARYEARGROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='NORRIS' AND @CODE=1 AND@VARYEAR!=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE VARYEAR=@VARYEARGROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='BGR' AND @CODE=1 AND @VARYEAR=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT IN ('G', 'H', 'I', 'J', 'K', 'L')GROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='BGR' AND @CODE=1 AND @VARYEAR!=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT IN ('G', 'H', 'I', 'J', 'K', 'L') AND VARYEAR=@VARYEARGROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='SP' AND @CODE=1 AND @VARYEAR=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT IN ('A', 'B', 'C', 'D', 'E', 'C', 'S', '3', '4')GROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='SP' AND @CODE=1 AND @VARYEAR!=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT IN ('A', 'B', 'C', 'D', 'E', 'C', 'S', '3', '4') ANDVARYEAR=@VARYEARGROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='NH' AND @CODE=1 AND @VARYEAR=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT IN ('W', 'X', 'Y', 'N', 'O', 'P')GROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='NH' AND @CODE=1 AND @VARYEAR!=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT IN ('W', 'X', 'Y', 'N', 'O', 'P') AND VARYEAR=@VARYEARGROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='UNH' AND @CODE=1 AND @VARYEAR=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT IN ('U', 'Z', 'R', 'V')GROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTHIF @REPORT='INVOICED' AND @OFFICE='UNH' AND @CODE=1 AND @VARYEAR!=1234SELECT VARYEAR , VARMONTH , SUM(AMOUNT) AS AMOUNTFROM #TEMP_SALESTRENDSWHERE PRODUCT IN ('U', 'Z', 'R', 'V') AND VARYEAR=@VARYEARGROUP BY VARYEAR, VARMONTHORDER BY VARYEAR, VARMONTH--END OF SALES TRENDS STORED PROCEDUREthanks.

View 4 Replies View Related

Update Column With Type Datetime

Dec 17, 2007

Hi,I want to update a column typed datetime. My statement is:update 'tablename' set Datum_Ende = '2007-12-17 08:49:04.000' where'columnID_name' = 23250 and 'columndate_Name' = convert(datetime,'17.12.2007 08:08:04')This effects an error. The Server said, the dateTime value is out ofvalid Domain.I have tried various statements like this and i think, the problem isthe blank between date and time.Can someone help me?ThanksThomas

View 2 Replies View Related

Multiple Type Rollup By Column

Nov 29, 2007



I'm trying to create a report where multiple currencies are rolled up into seperate subtotals. The currency type and amount are in seperate columns..

I'd like for my report to look like this
Account currency_type ammount

I'd like for the report to look like this
001 USD 100
001 USD 150
001 EUR 100
001 EUR 100
001 AUD 100
Total USD 250
EUR 200
AUD 100


Is there a way to do this?

View 10 Replies View Related

Which Data Type Should I Use To Store XML In A Column In DB?

Jan 29, 2006

I have xml string that needs to be stored in a field in the DB. I was looking for recommendations for the data type I can use in such a scenario.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved