|
hi guys anyone know whats the date function is in sql statment?
example of it in access:
> Date()
i want it in sql pls any one know?
|
|
|
|
|
getdate() ?
There is nothing in SQL, I don't think, I think that's a SQL Server specific call.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
so is there anyway for me to set the today date to an dat feild automatically during insertion of the record?
|
|
|
|
|
Yes set the default value to getdate()
|
|
|
|
|
getdate() function returns current date & time
ex.
SELECT getdate()
returns current system date & time
INSERT INTO tblA (col1) VALUES (getdate()
inserts current system date & time into "col1" of "tblA"
Regards
KP
|
|
|
|
|
|
Hi
I'm using this code:
cmd = new MySqlCommand("SELECT * FROM @table ORDER BY size LIMIT 20", conn);
cmd.Parameters.Add("@table", table);
reader = cmd.ExecuteReader();
However, @table is not replaced with the variable table, and thus I get an exception that my SQL query is not correct. Can someone tell me what I'm doing wrong?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
Thanks
Do I really need stored procedures for this task? I actually just wanted to avoid SQL injections, something like mysql_escape_string(table) does in PHP.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hope this is the right place - is anyone using SSIS here?
Let's say I have an input source which gives me a column of data that I'm interested in. Before inserting this data into my target, I need a couple of additional columns added to this data. One column is a sequence, 1, 2, 3, etc.. and the second column is a literal string. I'm pretty new to SSIS and I'm having some trouble getting off the ground.
Can anyone point me in the right direction?
Thanks!
Marcus
Marcus Spitzmiller
You will never hear me say, "I listen to pretty much everything." That is for people who don't care what goes in their ears.
|
|
|
|
|
Use a Derived Column task to add new columns to the data.
If I work out a simple method to generate a sequence, I'll let you know.
|
|
|
|
|
Thanks for the help!
Marcus Spitzmiller
You will never hear me say, "I listen to pretty much everything." That is for people who don't care what goes in their ears.
|
|
|
|
|
hi
i wanted to perform a search for records based on the date range specified by the user..
the input method is in mm/dd/yyyy in the webform
before going to the web from i just queried the table using the query builder and it constructed a query
SELECT patient.*
FROM patient
WHERE (Dt BETWEEN CONVERT(DATETIME, '2006-08-09 00:00:00', 102) AND CONVERT(DATETIME, '2006-09-09 00:00:00', 102))
now how do i use the same query to the webform... also how will i display the results in a gridview control..
also.. shud i create an stored procedure, by which i can make this possible
thx
Kunal
|
|
|
|
|
A stored proc is always a better idea. You can just pass a DateTime as a param to a stored proc
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
like this
<br />
<br />
create proc getrecords<br />
<br />
@StartDate datetime,<br />
@EndDate datetime<br />
<br />
AS<br />
<br />
SELECT patient.*<br />
FROM patient<br />
WHERE (Dt BETWEEN @StartDate AND @EndDate)<br />
<br />
<br />
go<br />
|
|
|
|
|
For searching data between two dates, you can also write the query as follows: Suppose that you want to search data between 01/03/2007 and 31/103/2007
Select field1, field2, datefield from tablename
where datediff(day,'01/03/2007',datefield) >= 0 and datediff(day,'31/03/2007',datefield) <=0 order by datefield
Meeram395
|
|
|
|
|
Hi all,
I'm using OLEDB to reading data from an excel file, using connection string below:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";
The problem I'm get in stuck in is OLEDB just read an excel file which have to have the first row is header, and then data row.
My excel file is formatted to use 6 beginning rows for introduction (not have any data), row 7 as header, then below is data row.
I couldn't read the file...Please help me!
Thanks in advance.
|
|
|
|
|
As you have discovered, Oledb will not handle that format. You will have to use the Excel automation / interop to handle that (bizarre) format.
|
|
|
|
|
Thank you. Please give me hint about that...
|
|
|
|
|
HI,
Which Data Type accepts both image and character in one sql column?
Thanks
|
|
|
|
|
You can store an address of image file and use a HyperLink in runtime
|
|
|
|
|
TEXT : but you have to encode the image data to base64 (ie text).
|
|
|
|
|
I want to increase the no of rows to prevent the backcolor of the Grid View
When I tried to increase DataGridrows as :
If Me.DataGridView1.RowCount < 20 Then DataGridView1.RowCount = 20
the error message :
RowCount property cannot be set on a data-bound DataGridView control.
can I deal with that to increase no of rows
jooooo
|
|
|
|
|
Since the grid is bound to a dataset, the number of rows in the dataset determine what is displayed in the grid. Why not just change the backcolor of the grid to match the backcolor of a row?
|
|
|
|
|
you are right ..
but I made alternating rows color ,, and some cells has it's own backcolor ,, then I can't make a single color
I hope you are see
jooooo
|
|
|
|