Percent Field Rounds To Whole Number
Apr 18, 2005
I am having a problem retaining the right 2 decimal places in my datagrid field. I have it defined as a decimal but when the update happens it rounds the decimal places back to .00.
Dim NewMarkup As String
'retrieve the new values
NewMarkup = CType(e.Item.FindControl("Markup"), TextBox).Text
'create the ado.net objects
Dim command As New SqlCommand("UpdatePricing", connection)
command.CommandType = CommandType.StoredProcedure
'parameters
command.Parameters.Add("@Markup", SqlDbType.Decimal, 5)
command.Parameters("@Markup").Value = CDec(NewMarkup)
Thanks!
View 2 Replies
ADVERTISEMENT
Oct 8, 2006
in my sql, i want to change a decimal number to percent format number, just so it is convenient for users. for example there is a decimal number 0.98, i want to change it to 98%, how can i complete it?
thks
View 4 Replies
View Related
Aug 21, 2007
dim ierr_amt as decimal mytxtErr_Amt = CType(item.FindControl("txtERR_AMT"), TextBox) ierr_amt = mytxtErr_Amt.Text 'this point ierr_amt is 8534.88 insert statement ByVal ierr_amt As Decimal aParms(3) = New SqlParameter("@ierr_amt", SqlDbType.Decimal) If ierr_amt = Nothing Then aParms(3).Value = DBNull.Value Else aParms(3).Value = ierr_amt 'this point also 8534.88 end if When I go check database it is value is rounded up and saved that way 8435 err_amt column in database takes money (10,2)
View 4 Replies
View Related
Dec 5, 2007
i want to import/copy a varchar field numeric data in to number field pls suggest the solution
one thing more can i convert field type of a table how?
jto it
View 5 Replies
View Related
Sep 25, 2006
Everytime i try to insert into my database it rounds all my decimals to ints. In design view they are decimals. Here is the code:cmd.Parameters.Add("@B_NetProceeds", SqlDbType.Decimal).Value = B_Proceeds;In Database i get 859Label1.Text = B_Proceeds.ToString() gives me 858.67 Why does it keep rounding? Also my float works fine. Its just the decimal.
View 7 Replies
View Related
Jul 11, 2007
hi guys,
i've been asked to re-write a sql view. the view itself contains several calls to other views (embedded). is there a way to get around using embedded views. I've written the same query up using temp. tables but obviously temp. tables can't be used in views?
Is there any special things I should be looking for?
View 2 Replies
View Related
Jul 12, 2007
Hi guys,I've been asked to re-write a sql view. The view itself containsseveral calls to other views (embedded). Is there a way to get aroundusing embedded views. I've written the same query up using temp.tables but obviously temp. tables can't be used in views?Is there any special things I should be looking for?
View 2 Replies
View Related
Nov 26, 2006
I am testing something in Visual Basic
that talks to a database and I want to
filter results by -> field1 like "###".
However, that 'like' and '#' is VB syntax.
How do you say that in SQL?
View 7 Replies
View Related
Jul 20, 2005
Hi :) and thanx for reading my post.I have to create a view based on a character in a number-field (fnr)which is 11 char's long. I have to get character nr "7".The problem is that i cannot use :--> SELECT fnr FROM table WHERE substring(fnr,7,1)since it's not a string.Any other way i can solve this ? Would be greatly and insanely happy ifanyone could help me out with a sample code or something.!Best regardsMirador*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 1 Replies
View Related
Feb 13, 2008
I have a part number field which contains whole numbers. (1 - 5000+) however there are gaps in the numbers e.g. Part Number 3876 maybe missing. The table has new parts inserted from a VB Client. Im trying to write a stored procedure where when a user trys to run an update without entering a part number the first missing part number is found. If they do provide a part number then their number is committed as long as it is unique. I've tried using cursors but am not sure on the best approach. Any suggestions?
Thanks in advance
Alex
View 6 Replies
View Related
Jan 17, 2005
Hi,
I need to formate one of my phone number field in SQL. now the data in the field is: 1234567890. I would like to formate the number to 123-456-7890. Does anyone know how to do this? Thanks.
Nicole
View 5 Replies
View Related
Feb 4, 2005
Hello,
I am developing a message board using ASP on IIS and SQL Server 2000, and I am running into a problem.
When a user enters their post, they enter their user name, subject, and of course all of their post content. Now the post content should be an unlimited number of characters since it could end up being multiple paragraphs.
I know I could just use an ASP file system object and write the text to a file, but I wanted to save all of these paragraphs as a field in a database table so I could pull it from the database so it could be edited by the user.
Is there a way to make a field be able to take in an unlimited amount of characters?
Or is this the wrong way to do things; is it bad to have an unlimited amount of characters in a table field? Should I stick to using the ASP System File Object?
View 1 Replies
View Related
Jul 20, 2005
I have a table with over a million rows and one of the fields containsamounts of money in text format.What is the most efficient way of converting this field to a numberformat that I can sum on?Regards,Ciarán
View 3 Replies
View Related
Nov 3, 2006
How would I write a query on a table containing a column of ints, where I want to retrieve the rows where that int value starts with a number? I know that you can do this with strings by using "....WHERE thisfield LIKE ('123%')", but if 'thisfield' is an int, how would I do this? Thanks!
View 3 Replies
View Related
Jun 1, 2006
i have a field which is CHAR(20), and it is allowed to only containe number chars.
is there any collation_name can help ? or how can i set the check clause ?
View 9 Replies
View Related
Mar 21, 2008
Hi,
I need to represent two different (number) fields in the same textbox , one number format is C0 (Currency) and other one is Percentage(P1), how can i keep this number format applicable to appropriate fields?
for exaple this is the expression to represent the two fiels in one textbox.
=Fields!Amount01.Value & vbCrLf & Fields!Amount01Percentage.Value
Thanks in advance.
View 6 Replies
View Related
Feb 8, 2006
How can I allow users to input numbers with commas into a database field with an 'int' datatype without getting this error, 'Input string was not in a correct format'?
View 3 Replies
View Related
Sep 10, 2001
I have a phone number field.
I would like to remove the hypens and brackets.
Do anyone know of any functions, I can use to accomplish this??
Thanks in advance!
--Vic
View 1 Replies
View Related
Feb 8, 2007
Hi there!
I'm using a Switch statement in my SQL as follows:
Code:
SELECT symbol,
Switch(timestamp Is Null,Null,
timestamp <= 005959, 0,
timestamp<=235959,23) AS period
INTO averageprice
FROM stocktrades;
Now here's my problem. The Data Type stored in the 'period' field of this new table I've created, dubbed averageprice, is a Text field and I want it to be a Number field. I've tried my best to figure this out and I'm still looking so any helpful hints or solution would be greatly appreciated. Thanks!!!
View 1 Replies
View Related
Dec 15, 2005
Hi!
I have a table called DB1 that contains this:
MID
IIN
NUM_EVENTS
DATE
MID, IIN and NUM_EVENTS are composite keys. and only NUM_EVENTS get incremented. All records start with NUM_EVENTS = 1.How can I create a query that only displays those records that only NUM_EVENTS = 1 meaning their still on the first stage of processing?
View 6 Replies
View Related
Sep 22, 2014
I am facing problem with re numbering of field records in a table.I am having one table with below records.
sid(identity/primarykey) stickyId(Integer) UserId(integer)
102 0 171
103 1 171
104 2 171
105 3 171
here how to renumbering stickyId values when deleted particular stickyId from UI. Here stickyId field is Integer type only. not primarykey/identity field.
View 3 Replies
View Related
Dec 15, 2005
Hi!
I have a table called DB1 that contains this:
MID
IIN
NUM_EVENTS
DATE
MID, IIN and NUM_EVENTS are composite keys. and only NUM_EVENTS get incremented. All records start with NUM_EVENTS = 1.How can I create a query that only displays those records that only NUM_EVENTS = 1 meaning their still on the first stage of processing?
$3.99/yr .COM!
http://www.greatdomains4less.com
View 3 Replies
View Related
Aug 21, 2015
Any easier way to do what I am trying, without having a table with all the dates and week numbers.
Scenario: Week number of a DateTime Field where the year does not start on January 01<sup>st</sup> but April 1<sup>st</sup> to 31 Mach.
Issue: A week always starts on a Monday so if the 1<sup>st</sup> is on Tuesday, the first week is Tuesday – Sunday, if the 1<sup>st</sup> April is on Friday, the 1<sup>st</sup> week is Friday – Sunday and 7 day periods from there.
CREATE
TABLE [dbo].[DailyCanx](Â Â Â Â Â
[ID] [int] IDENTITY(1,1)
NOT NULL,    Â
[DateCancelled] [datetime] NULL
)
ON [PRIMARY]
[code]....
I could create a table with all the start date and end dates of all the week numbers but I think there must be a better way. using SQL Server 2008 R2.
View 5 Replies
View Related
Apr 25, 2008
Hello:
I have a field hold varchar. I would like to calculate how many character in the field when user enter the data and save in the database.
Is there any way to do?
Thanks,
Snow
View 3 Replies
View Related
Jul 7, 2015
I have this rows as result of my query:
aaaaa     bbbbb      date       result
-------Â Â Â Â -------Â Â Â Â Â --------Â Â Â ---------
a           100         7-7-15
a           100         7-7-15
a           100        8-7-15
b           200         7-7-15
b           200         8-7-15
b           200          8-7-15
I need this (divide bbbbb by row count as result, group by "aaaaa and date":
aaaaa     bbbbb      date       result
-------Â Â Â Â -------Â Â Â Â Â --------Â Â Â ---------
a           100         7-7-15      50
a           100         7-7-15      50
a           100        8-7-15     100
b           200         7-7-15     200
b           200         8-7-15      100
b           200          8-7-15      100
Can I do it?
My SQL Code is
(date=FEC, RESULT=COSTECUB, aaaaaa=TRACTA, bbbbb=TRAPR3)  :
SELECT VTRA00F.TRACTA, ACRDES, TRAPRL, TRAPR1, TRAPR2, TRAPR3,
CASE WHEN TRAPR3 IS NULL THEN
(CASE WHEN (ALLQDE+ALLQCN+ALLQCR+ALLQMR+ALLQNN+ALLQNR+ALLQV1+ALLQV2) <= TRAPRL THEN (TRAPR1*(ALLQDE+ALLQCN+ALLQCR+ALLQMR+ALLQNN+ALLQNR+ALLQV1+ALLQV2)) ELSE (TRAPR2*
[Code] .....
View 8 Replies
View Related
Feb 27, 2003
Can any one help me, i'm building a dynamic database driven site using dreamweaver and MS SQL2000 andi'm haveing problem storing over 8000 characters in a table filed (IE: it wont let me!!) is there a special table field value that i need to set to get more characters in a table field or is this a limitation of SQL.
Any help or suggestions would be appreciated
Regards
B
View 3 Replies
View Related
Jun 26, 2015
I need to have a table that has a primary key
CREATE TABLE [dbo].[testing](
[tid] [int] IDENTITY(1,1) NOT NULL,
[sometext] [varchar](150) NOT NULL,
[idcopied] [varchar](50) NULL,
CONSTRAINT [testing_PrimaryKey] PRIMARY KEY CLUSTERED
..and eveytime I add 'sometext' as another row, the tid # needs to be duplicated to idcopied field
insert into [testing] (sometext,idcopied) values ('some junk',@@identity)
???
View 4 Replies
View Related
Mar 20, 2006
If I pull a value from a MSSQL field with is defined as money, how can I get it to display in a textbox with commas and NO decimals?
87000.0000 = 87,000
I can currently remove the decimals like below but is there a way to add the commas as well?
decRevenue = drMyData("Revenue")
txtRevenue.Text = decRevenue.ToString("f0")
It current shows "87000".
View 1 Replies
View Related
Jun 16, 2012
Ok I have upgraded my works database from a poorly designed Access database to a SQL database. The previous system allowed NULL values and duplicates to be inserted into a field that should NOT ALLOW NULL Values or duplicates. Therefore, this issue has now been moved across to my new system as I cannot set these constraints on the field that has multiple NULL values.
My solution would be to use a sequential operator, so whatever = NULL would be changed to a sequential number that us as administrators would know was a bogus number starting at something like = 999999900 counting up from that. There are only 250 records that would require updating.
To make things more interesting this field is not a integer type, its a Nvarchar type as its a Hardware ID. Both numerical and characters are require.
View 1 Replies
View Related
Jul 20, 2005
When querying a bit field, I am encountering a problem with MS SQLServer returning a larger number of records for a table than theactual number of records that exist within that table.For example, my customer table has 1 million unique records, so theresults of the following query are as such:select count(customer_nbr) from customer = 1,000,000There is bit field in the customer table that denotes whether acustomer has placed an order with us called. That flag is calledorder_flagIf I run the following query:select count(customer_nbr) from customer where order_flag = 1The result is 3,000,000 records.There is no logical way that this is possible, as my table onlycontains 1,000,000 unique records and the number of customers with anorder should be a subset of this.If a run the above query with a distinct before customer number, I getthe results I want:select count(distinct customer_nbr) from customer where order_flag = 1600,000 records.So while I can get to the answer I want, I have no idea why I amreturning incorrect values if I don't select distinct.Can anyone help? I checked microsoft support and message boards buthaven't seen anything.I should note that the bit field is indexed.I am not sure if that isthe problem or not.
View 1 Replies
View Related
Dec 1, 2007
For a field in a database to accept both text and number what 'Data Type' should I be using, i.e. 23t5
View 1 Replies
View Related
Aug 31, 2007
I get this error when I look at the state of my SQLresults object. Have I coded something wrong?Item = In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user. conn.Open()
Dim strSql As String
strSql = "INSERT INTO contacts (companyId, sourceId, firstName, lastName, middleName, birthday, dateCreated)" _
& "VALUES ('" & companyId & "', '" & sourceId & "', '" & firstName & "', '" & lastName & "', '" & middleName & "', '" & birthday & "', '" & now & "') SELECT @@IDENTITY AS 'contactId'"
Dim objCmd As SqlCommand
objCmd = New SqlCommand(strSql, conn)
Dim aSyncResult As IAsyncResult = objCmd.BeginExecuteReader()
If aSyncResult.AsyncWaitHandle.WaitOne() = True Then
Dim sqlResults As SqlClient.SqlDataReader
sqlResults = objCmd.EndExecuteReader(aSyncResult)
Dim cid As Integer
cid = sqlResults.Item("contactId")
Me.id = cid
conn.Close()
Return cid
Else
Return "failed"
End If
View 3 Replies
View Related
Oct 1, 2015
In report builder 2.0, I cannot determine how to display the number of times a field has been filled out when a  one to many relationship is involved. I get an error every time I use two aggregates.
ID, Symptom_ID
1, 111
2, NULL
3, 222
3, 333
3, 444
4, NULL
5, 666
The result should be 3 out of 5 records... Or even better displayed as a percentage of the total 60%
View 2 Replies
View Related