How do you set a default value for a MySQL Datetime column?
In SQL Server it's getdate(), what is the equivalant for MySQL? I'm using 5.x if that is a factor.
What column type should I use for storing html content from a website with an unknown size?
(I'm scanning certain html pages, and create an database entry if there are changes between the last stored entry and the current html code.)
I have datatable like :
id name address
---------------
1 abc akjdk
2 bcd dkjkl
Now I want to insert one column with data in between to that datatable like :
id name phoneno address
-----------------------
1 abc 11231 akjdk
2 bcd 12313 dkjkl
How can I do this ?
Update Combined column using CategoryCode of every OrderId. In this example there are two OrderIds 990 and 986. Need to concatenate categories of these two individually.
The desired result is like this.
990 Bus, Pub, Shoot, Club, Bus, Hos
Thanks.
DataGridView inserting an extra row every time I populate with data. The row appears even if I Only fill the column headers. This is causing problems when I try to get values of each cell.
Is there a way to avoid this perhaps in properties?
Thanks in advance for any suggestions.
Is there a way to create a table in sqlite3 that has a datetime column that defaults to 'now'?
The following statement returns a syntax error:
create table tbl1(id int primary key, dt datetime default datetime('now'));
I have a gridview that is bound to a datasource (Windows Forms, VB.NET). One of columns is a property of type boolean, and I want to show "yes/no" in the column instead of 0/1 or "true/false". Is this possible? Can you edit displays of columns that are bound?
Hi
I have an Excel spreadsheed like the one shown below
A B
10.02.2007 10
10.03.2007 12
Column A is date and B is price of share
Now in another sreadsheet I need to create a new column called return
In this column i need to place formula like = ln(B2/B1)
but on condition that this formula is only applied date in column A is in range
StartDate < currentDate < EndDate.
So I want to
apply my formula only to specific period say only to 2007 year
have new column placed in another spreadsheet starting from given location say A1
Please suggest
I am aware of the MySQL Date_Format function but am looking to achieve the following:
I have on column with a day date in 2 digit format (01-30). I am trying to update another date formatted field with the current year, the next month (m+1) and the day field mentioned previously.
In PHP i would do this using mktime function but this must be done using mysql calls only.
Is it possible to transform in this way?
How to get the Grid.Row Grid.Column from the added control?
Basically I have 16 grids with 4 rows and 4 columns, each grid is added a round button.
how to determine which rows and columns the selected round buttons are located respectively in the below MouseEventHandler of mouseover? For mouseclick, there is only round button selected, but for mouseover, there would be a collection of buttons.
RoundButton_MouseEnter, RoundButton_MouseLeave, RoundButton_MouseDown, RoundButton_MouseUp
Thanks
class Radio(models.Model):
title = models.CharField(max_length=2000, blank=True, null=True)
listeners = models.IntegerField(default = 0, blank=True, null=True)
I don't want duplicate TITLE column. How do I set a unique key?
How can i learn table Name in database an how can i learn any Table's Column name?
SELECT Col.COLUMN_NAME, Col.DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS AS Col
LEFT OUTER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS Usg ON Col.TABLE_NAME = Usg.TABLE_NAME AND Col.COLUMN_NAME = Usg.COLUMN_NAME
LEFT OUTER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS Con ON Usg.CONSTRAINT_NAME = Con.CONSTRAINT_NAME
WHERE Col.TABLE_NAME = 'Addresses_Temp' AND Con.Constraint_TYPE = 'PRIMARY KEY'
But it returns to me empty data:(
I have a Postgres table called clients. The name column contains certain values eg.
test23233 [987665432,2014-02-18]
At the end of the value is a date, I need to compare this date, and return all records where this specific date is younger than today
I tried
select id,name FROM clients where name ~ '(\d{4}\-\d{1,2}\-\d{1,2})';
but this isn't returning any values. How would I go about to achieve the results I want?
I have the following validation:
validates_presence_of :price, :message => "my message"
and I get the following error when the price is blank:
Price my message
Is there a way not to include the column name (price) in the message ?
I tried to do:
validates_presence_of :price, :message => "^ my message"
as suggested here, but it didn't work for me. I got the following message:
Price ^ my message
I am running a QTP script where a data is produced dynamically.I am retriving the data during runtime and then I need to paste that data in an excel sheet (in an column).Please suggest how to code it. Thanks for any help.
I need a macro to do this please - any know where i can find one? Find a column with specified text and then search rows for zero enries and delete whole row if zero found
when i try to select and update the same table mysql gives error
error
#1241 - Operand should contain 1 column(s)
The trigger is
DELIMITER $$
CREATE TRIGGER visitor_validation
BEFORE INSERT ON ratingsvisitors
FOR EACH ROW
BEGIN
SET @ifexists = (SELECT * FROM ratingcounttracks WHERE userid=New.vistorid AND likedate=New.likevalidation AND countfor=New.likeordislike);
IF (@ifexists = NULL) THEN
INSERT INTO ratingcounttracks(userid, likedate, clickcount,countfor) values (New.vistorid, New.likevalidation ,'1',New.likeordislike);
ELSE
UPDATE ratingcounttracks SET clickcount=clickcount+1 WHERE userid=New.vistorid AND likedate=New.likevalidation AND countfor=New.likeordislike;
END IF;
END$$
AccountCode
01-80-07
03-24-00 True
03-24-00
03-69-00
04-16-00 True
04-20-00
04-21-00
05-99-00 True
07-01-00 True
07-01-00
07-10-00
07-10-00
94-40-95 True
Does anyone understand what I need? Trues are in column B and each month there may be a different number of trues and different spacing between them.
hi,
i have one problem that, i have to change type of data in column based on foreign key stored in that row.
unit_id unit_name
1 String
2 Float
3 Date
4 Int
Id spec value unit id
1 "A" 1
2 30.90 2
3 null 3
4 100 4
now i should achieve the above codition. how do i achieve it? please help me.
Hi there,
I am in need of reorganizing a large CSV file. The first column, which is currently a 6 digit number needs to be split up, using comma's as the field separator.
For example, I need this:
022250,10:50 AM,274,22,50
022255,11:55 AM,275,22,55
turned into this:
0,2,2,2,5,0,10:50 AM,274,22,50
0,2,2,2,5,5,11:55 AM,275,22,55
Let me know what you think!
Thanks!
I tried session.createSQLQuery("ALTER TABLE People MODIFY address VARCHAR(1000);").executeUpdate();
but this throws org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
After a lot of googling, the recommendation is to use HQL instead of SQL query to do bulk updates. Not sure how to use HQL to accomplish this. There seems to be no decent HQL documentation for updating column length in a table.
Thanks so much for the help.
We have following type of "Unique ID" column for many tables in the database (Oracle). It is a string with following format
<randomnumber>-<ascendingnumber>-<machinename>
So we have some thing like this
U1234-12345-NBBJD
U1234-12346-NBBJD
U1234-12347-NBBJD
U1234-12348-NBBJD
U1234-12349-NBBJD
The UID value is unique, we have unique index on them. Does the following format is more efficient than above for index scans?
NBBJD-U1234-12345
NBBJD-U1234-12346
NBBJD-U1234-12347
NBBJD-U1234-12348
NBBJD-U1234-12349
My C# code looks like this:
myNum = dt.Columns[0];
myNum is an integer and dt is a datatable. The value in column 0 of dt is a string ("12"), but I'd like to convert it to an integer. How can I do this?
I've tried:
myNum = int.Parse(dt.Columns[0]);
...but that doesn't work. Any ideas?
I am writing a Pylons-based download gateway. The gateway's client will address files by ID:
/file_gw/download/1
Internally, the file itself is accessed via HTTP from an internal file server:
http://internal-srv/path/to/file_1.content
The files may be quite large, so I want to stream the content. I store metadata about the file in a StoredFile model object:
class StoredFile(Base):
id = Column(Integer, primary_key=True)
name = Column(String)
size = Column(Integer)
content_type = Column(String)
url = Column(String)
Given this, what's the best (ie: most architecturally-sound, performant, et al) way to write my file_gw controller?