Testing For Field Type/Status
Feb 22, 2008
Hello,
We are trying to test for a field in our 'setup' table and no matter what we do it's has a personality of its own. It's the wackiest thing. The field has two steps in this update script - first we are checking to make sure the field 'set_fsm' is still in the table, if so then we are blanking out the field by updating the value to a pair of ' '. Next, after the field now has just a blank value we are going to change the data type from char(10) to a bit field. However, when we try to check the code the first time it works but every other time the update script runs it doesn't work. The code below are two approaches that we have tried with our general update tools that is run on each version / product release we have. Assistance is greatly appreciated.
The record doesn€™t exit yet it still falls into the BEGIN.
IF exists (select * from dbo.syscolumns where name = 'set_fsm'
and id = (select id from dbo.sysobjects where name = 'setup'))
BEGIN
PRINT €˜I am here€™
UPDATE setup SET set_fsm = ''
END
It won€™t print the €œI am here€? but still tries to update the table!!!
Here€™s the results:
Server: Msg 207, Level 16, State 1, Line 1
Invalid column name 'set_fsm'.
Someone else said try this€¦
IF EXISTS (SELECT 1
FROM sysobjects o
JOIN syscolumns c on o.id = c.id
WHERE o.name = 'setup'
and c.name = 'set_fsm'
and o.xtype = 'U') -- because index columns are also stored in the sysobjects table
begin
print 'Found column'
update setup set set_fsm = ''
END
else
begin
print 'set_fsm column not found in table setup'
end
Same results:
Server: Msg 207, Level 16, State 1, Line 1
Invalid column name 'set_fsm'.
View 3 Replies
ADVERTISEMENT
May 17, 2015
I embedded a SQL query in excel that gets some datetime fields like "TASK_FINISH_DATE"Â .
How can I convert a datetime field to a date field in SQL in a way that excel will recognize it as a date type and not a text type?
I tried:
CONVERT(varchar(8),TASK_FINISH_DATE ,3)
CONVERT(Date,TASK_FINISH_DATE ,3)
CAST(TASK_FINISH_DATE as date)
**all of the above returned text objectes in excel and not date objects.
View 3 Replies
View Related
Mar 1, 2007
Hello,
I have a database design question. I want to store a status in a table. In the ASP.NET interface for the user this status will be adapted to the language of the user.
This is how it would look like:
StatusID 1 = "yes" for English, "oui" for French, "ja" for DutchStatusID 2 = "no" for English, "non" for French, "neen" for DutchStatusID 3 = "error" for English, "erreur" for French, "fout" for Dutch
I don't want to do the translation in ASP.NET and it should be done in one query.
How would it look like in the database design.
View 5 Replies
View Related
May 2, 2006
Dear All
Within the sysusers table there is a field named status... All the users has this field set to 2. However there is a particular user and the status for this user is set to 14. Does anyone knows what this means... i.e. why the status field is not set to 2 as it is for the other users?
Regards
Sandro
View 1 Replies
View Related
Apr 20, 2007
I am trying get the status field from the list of jobs in management. I have a activex script that queries system tables to find out if a job has failed and sends the report via e-mail.
Currently I use this query to get the names of jobs failed...
SELECT
name
FROM msdb.dbo.sysjobs A, msdb.dbo.sysjobservers B WHERE A.job_id = B.job_id AND B.last_run_outcome = 0
ORDER BY name
I need to add some criteria around the status field to get the appropriate results.
anybody?
Cheers :beer:
View 1 Replies
View Related
Oct 17, 2007
I am trying to drag data from Informix to Sql Server. When I kick off the package
using an OLE DB Source and a SQL Server Destination, I get DT_DBDATE to DT_DBTIMESTAMP
errors on two fields from Informix which are date data ....no timestamp part
I tried a couple of things:
Created a view of the Informix table where I cast the date fields as datetime year to fraction(5), which failed.
Altered the view to convert the date fields to char(10) with the hopes that SQL Server would implicitly cast them
as datetime but it failed.
What options do I have that will work?
View 1 Replies
View Related
Sep 4, 2015
During our DR drill we found that the same code which used to run perfectly fine on our Primary Data Centre is running very slow on Disaster Recovery DB Server and there are Lot's of open transaction with sleeping status and waittype as 'AWAITING COMMAND'.CPU, Memory and disk utilization are good. The ping reply between the app server and the DB server is well within the limit's even blocking is not their, also nothing is reported in the error logs. We are using SQL server 2014 STD 64 BIT on Windows Server 2012.
View 6 Replies
View Related
Mar 26, 2007
Consider the following tableCustomercustId char(10)accountExpiryDate datetimeaccountStatus bitNow, I want to update the accountStatus to False as soon as thecurrent date becomes accountExpiryDate.I think it can be done using "SQL Agent" but my webhost doesnt provideme access to that. I have access only to the Query Analyzer.ThanksShane
View 12 Replies
View Related
May 11, 2015
I have table in which month & year are stored, Like this
Month Year
10 2014
11 2014
12 2014
1 2015
2 2015
3 2015
4 2015
I wanted a query in which it should return the value in a status field which has latest year & month.
View 9 Replies
View Related
Nov 7, 2004
I'm using Microsoft SQL Server 2000 on windows 2000 Professional OS.
I want to make a field having capacity of 100,000 characters. What datatype should be best for this requirement.
View 1 Replies
View Related
Jul 23, 2005
Hi FriendsI have question.I connected oracle and MS access tables(via Delphi7).I wanna get type of field in indicated table. For example if it isinteger or boolean e.t.cPlease tell me the SQL function or whatever that retrievs type of field.Thanks*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 1 Replies
View Related
Mar 28, 2007
Hi guys
I need immediate help with a query that I am trying to write. I want to sum the values in a query but the field has a type of varchar and it has decimal numbers too. So if I do the query something like that, that converts the field to int, I get the error message.
I tried converting it into real or float but I get error message on that too. I need help with adding the calculatedValues and getting there sum. I would appreciate any help with that.
Thanks
-Sarah
Select SUM(Convert(int, calculatedValue))
from monitor.dbo.monHistory
where LocalTimeWithoutDst > '8/26/06' and LocalTimeWithoutDst < '8/28/06'
This is the error message I recieve:
Conversion failed when converting the varchar value '274.2' to data type int.
View 6 Replies
View Related
Aug 4, 2004
Hi,
I want to update a field in my table whose value is a 0, to a value 1. This field is of type bit and here is the SP that I wrote to achieve this. Somhow, its giving some error when I tried executing it in the Query Analyzer. What am I doing wrong here??
CREATE PROCEDURE PublishSchedule
(
@SiteCode smallint,
@YearMonth int
)
AS
DECLARE @Active bit
IF ( (SELECT COUNT(*) FROM CabsSchedule WHERE YearMonth = @YearMonth AND SiteCode = @SiteCode) > 0 )
BEGIN
UPDATE CabsSchedule
SET Active=1
WHERE SiteCode=@SiteCode AND YearMonth=@YearMonth
END
GO
Thanks
View 4 Replies
View Related
Feb 17, 2007
I have a field ID of type integer, I want to put two numbers in that field: 3 and 7, so what I do is just store the number 37.Now, is there a command in SQL server which checks if the ID field contains a number I look for, say 7.Something like a CONTAINS keyword...If there is, could someone please tell me what it is AND tell me a bit more about it :memory usage, (dis)advantages etc.
View 1 Replies
View Related
Jul 14, 2007
Hi, I have a table which holds raw xml in a field with type XML. How do I export that XML field to an XML file? Thanks Bones
View 6 Replies
View Related
Jan 15, 2008
I am new to asp.net, C#, and sql server, coming from php and ODBC/Access background (trying to leave all that behind) Anyway, I have a textbox that will be used to INSERT a date into a SQL datetime field. The date coming from the textbox will be formatted like "MM/dd/yyyy". For my purposes the day, month, and year are all that I require, the time is irrelevant. Then from a different page in the site I will be using a variable containing the current date derived from "DateTime.Now.ToString("MM/dd/yyyy")" to select records with a matching date. Is there anyone that has an example showing both inserting into a datetime field and extracting records based off the date format that I have specified? Would it be better to use a different format? In the past I have stored dates as a julian in an int field type but I would rather learn to use the datetime field type in sql. Any help would be greatly appreciated.
View 1 Replies
View Related
Mar 17, 2008
Hi, I want to store a time duration such as 1:30 (mm:ss), 1:00, or 1:23 in a SQL 2005 database. What is the best data field type for this data? DateTime or TimeStamp? Thanks
View 2 Replies
View Related
Feb 25, 2005
Hi,
I was wondering if someone can help me with is problem.
I have uploaded word docs to the db which is fine. The problem is viewing. I can view then as word documents but the boss does not want the files opened in word.
Is it possable to retrieve the file from from the db and put into say a textbox or lable.
I can see the letter P using this code
Dim Doc() As Byte = New Byte(Convert.ToInt32(0)) {}
Dim bytesReceived As Long = DBContent.GetBytes(0, 0, Doc, 0, Doc.Length)
Dim encoding As ASCIIEncoding = New ASCIIEncoding
lblTest.Text = encoding.GetString(Doc, 0, Convert.ToInt32(bytesReceived)).ToString
Can any help
Thanks
View 4 Replies
View Related
Feb 4, 2006
hi all, the field type :datetime and smalldatetime, i still can't understand.everytime when i inserted the data to the db, i also get the error message "System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."i must change the field type to string, so that i can insert data my codetxt_datetime.text = '5/2/2006'insert into datetime (datetime) values ('"& txt_datetime.text & "')"can anybody tell me the reason???thank you!!
View 4 Replies
View Related
Jul 9, 2004
I have a field with exam scores. 77, 89.5 ect. range :0-100
What datatype shall I use?
View 2 Replies
View Related
Dec 29, 2004
Is there a data type in SQL Server for entering hyperlinks to websites? MS Access has a hyperlink data type but I can't find a corresponding SQL Server data type which I can use.
View 4 Replies
View Related
May 17, 2004
Hi Everybody,
In a table there´s a field for store real values,
so...in the database, using the SQL Server Enterprise Manager
and execute query as 'select * from' and it return the value
'15,35' just like stored before, why using Delphi via an ADO conection
in my result set there is a '15,3500003814697' value if in the record time
the inputed value was '15,35'?
What I have doing wrong?
Thanks for attention
Leonardo Almeida
View 2 Replies
View Related
Jun 7, 2014
Is there an easy way to send back to my C# program the pascal case of a field type? If you get the parameters or columns for a table or procedure the type is in all lowercase (varchar instead of VarChar). But in C#, it is in an enum (SqlDbType) that has the variables as mixed case so you can't compare them and just pass the type. You need to figure out what the case should be - varchar should be VarChar and bigint should be BigInt.
View 1 Replies
View Related
Sep 8, 2013
What should be data type of password field?
View 2 Replies
View Related
Jan 31, 2007
I want to zip up some HTML and store it a field. 2 questions:
1: Are there any sample scripts available for this, I haven't found any?
2: What Type should the storage field be for that?
Thanks,
--PhB
--PhB
View 6 Replies
View Related
Mar 3, 2007
Hi,
I am using SQL Server 2005 Express. I am creating a table, which will have a comments field. Whats an appropriate data type that should be used for a "comments" field? So far, I have unlimited text and characters can be entered, but that a limitation can be placed.
Thanks
Chirs
View 1 Replies
View Related
Apr 11, 2007
I'm using XmlDataSource to build reports based on WebService output (as plain XML text). (SSRS2005)
I have several fields which contain Float/Decimal/Integer value, but RS reads them as text and I have to use CDbl() to convert text to numeric value.
In MSDN I found some info about "Type" attribute(?) for XmlElement.
My xml is:
...<Field1 Type="Float">34567.89</Field1>...
But RS still reads data from this field as text.
Is there any way to specify field's (xmlelement's) data type instead of using CDbl() function everywhere?
View 3 Replies
View Related
Mar 11, 2007
Does the IDENTITY field type in SQL have a maximum size to it?
You know like int only goes so high up,
View 1 Replies
View Related
Mar 18, 2008
Hi
I am currently working on an application that uses a stored procedure to retrieve data from a database and then display it in a web page. My problem is that some of the data in the database will be images, I am currently putting in test data to test my code/procedures my problem is how do I put in test data for images, when I am finished I am going to add an admin section that will allow me to add images that way but how do I go about adding them to the database until then? I have set the field to the image data type but have no idea how to relate this to an image on my server?
Thanks, Adam
View 1 Replies
View Related
Feb 25, 2005
Hi - I'm using Session variables to store information (sort of webshop).
The sessions are a mix of the usual straightforward strings, wich are no problem - but I also have a DataTable which I store in a session variable, and I also have an array, which I store in a session variable eg. session("day")(x) where x is the item in the array.
I want to give my users the ability to store the items they've selected in my database, but have no idea of what type of field I should use for the datatable and array session variable. Should I use a TEXT field, or is there another more appropriate one'?
I'm using SQL Server 2000.
Thanks for any help,
Mark
View 3 Replies
View Related
May 23, 2006
Hi,
I have update function that updating sql database table.
In the table I have fields like: name, address, phone, …, install_date
updateScreen(txtSName.text, txtSLocation.text, txtSPhone.text, txtSAddress.text, txtSPostal.text, ddSCity.SelectedItem.text, ddSCountry.SelectedItem.text, txtSOwner.text, txtSInstall.text )
The function work fine except the part whent install_date field is empty then I have the following message:
System.InvalidCastException: Conversion from string "" to type 'Date' is not valid.
Ii would like to use the same update function to make an updates even when date field is empty.
If someone has any idea how make it work, I would appreciate that
Alex
View 4 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
Jul 25, 2006
Hi all,
Hi am creating a new database not sure which way is the best way to go. Here are the questions
I have a history table which has its an identity field and an identification field which shows what type of history field it is. As in payment, printout, change and so on.... For this field should i use
Full text which has the payment, printout, change and so on and make it easy on the eye and for queries and coded to use the same text all the time
have varchar(2) type of field which holds an understandable field PR, PO, CH and a reference table for it as in PR= PAYMENT, PO = Printout, CH as in change and so on
or have a integer field as in 1, 2, 3 and ref. table 1=payment, 2 = printout, 3=change and so on
I have a address table which holds multiple types of addresses which are really limited count maybe upto 4 different types
have a integer field which links to a reference table as above
have bit fields which can be used to check if it gets in one of the group types
have a full text option like above
Im open for any type of suggestions and i would love to hear the reasons why its picked TY
View 1 Replies
View Related