|
Why did you delete your original question? The one that I answered here[^]
shriku24 wrote: But in table it looks as some code(number, hex or binary) format not as actual name of that file
Because you didn't ask to store the name of the file, you asked to store the file in the database. What you are seeing is the actual file.
shriku24 wrote: i can't retrive(play) this file
I can't help you play the file. This question is in the SQL forum. I can only help you store and retrieve the file from the database. When you retrieve the file from the database you have it already as a raw byte array. From that point onwards you can do anything you want with it.
|
|
|
|
|
Colin Angus Mackay wrote: can only help you store and retrieve the file from the database
Which datatype we need to use for storing files in database ?
|
|
|
|
|
DooDooo wrote: Which datatype we need to use for storing files in database ?
byte[] in .NET
image or varbinary(max) in SQL Server
|
|
|
|
|
Can't get the simplest query to work. I am moving from Coldfusion to ASP.NET and having extreme headaches trying to get the most basic query to run. I want to query one table and pull all rows where the date in one column is equal to the current system date (simple enough). My query is as follows:
<p>
<pre>
SELECT [NoticeDate], [NoticeTitle], [NoticeDetails], [NoticeID]
FROM tbl_notice
WHERE @NoticeDate = 'DateTime.Now'
</pre>
<p>
I have also tried WHERE @NoticeDate = 'GetDate()'
I am using VWD Express (C#) querying a SQL 2005 DB. Thanks.
|
|
|
|
|
If you use something like GetDate or DateTime.Now, you are actually working with a date/time instance. What you need to do is convert the date into a day format and compare that to @NoticeDate.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
briwright wrote: I have also tried WHERE @NoticeDate = 'GetDate()'
Try by saving GETDATE() into local variable and use it for comparision.
DECLARE @curr_datetime datetime<br />
SET @curr_datetime = GETDATE()<br />
<br />
SELECT [NoticeDate], [NoticeTitle], [NoticeDetails], [NoticeID]<br />
FROM tbl_notice<br />
WHERE @NoticeDate = @curr_datetime
Hope this will solve your problem.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi,
I'm using a .mdf (&.ldf) sql DB file in my ASP.NET application (it's in \APP_DATA), and I can see in the connection string that it is connected via SQLEXPRESS.
I know I can take the same .mdf file and attach it to MSSQL server and work with the same file under a MSSQL connection.
My question general is: After migrating a DB file from SQLEXPRESS to MSSQL will my DB work as a regular MSSQL DB or it will still have the SQLEXPRESS limitaions?
Thanks
Rafael.
Moreno
|
|
|
|
|
The limitations will most likely be in the software, not the file.
|
|
|
|
|
So if I use the same mdf file via MSSQL I will Not get any SQLEXPRESS Limitations?
Moreno
|
|
|
|
|
Correct.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
I Have a MS SQL Store proc, which takes max value of a field from the table for a day ( That field has got date part )and adds 1 if it exists or creates new if it does not exists.
Logic is like this
select a = max ( ID) where ID like (20070321%) /*Denotes March 21 2007*/
if (a is null ) set 200703210001
else a = a+1
insert into table (ID,....) values (a,....)
I am getting primary key violation error occassionaly.
I would like to know, How the SQL Server handles concurrent request for executing storedprocedures.
For example if it is sequential my logic should work fine
else
There can be duplicate values for ID fields.
Please help.
I knew it would end badly when I first met Chris in a Canberra alleyway and he said 'try some - it won't hurt you'..... - Christian Graus on Code Project outages
|
|
|
|
|
If this is in SQL Server 2005, you can wrap it inside a TRY/CATCH block.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Thanks for the reply.
It is SQL 2000 / 7.0
Any other optimal solution
A moment of silence please. A programmer's best friend has passed beyond that great exception in the sky.... - Mark Conger on "The coffee machine has died"
|
|
|
|
|
Well, you could always try something like this:
insert into table1(...)
select @id, @col2, @col3
from table1 where not exists (select id from table1 where id = @id)
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Personally, in this case I'd use an Identity column for the primary key, and put the date information in another column defaulted to get the date (DEFAULT GETDATE()). I'm not sure what having the date as part of the primary key is buying you.
Scot
|
|
|
|
|
How can i insert the char " ' " into my sql Statement so that the SQL server 2000 take it by using VB.net 2005
|
|
|
|
|
Replace ' with ''
str.replace("'","''");
|
|
|
|
|
WARNING: The original question could be a symptom of a security hole.
|
|
|
|
|
Thanx it solved the problem
|
|
|
|
|
Be very careful with his solution at it can hide security problems. It you want to reduce the risk of your database being attacked then I suggest you don't use that solution.
|
|
|
|
|
Colin Angus Mackay wrote: Be very careful with his solution at it can hide security problems.
Could you please explain this in detail ? I am not getting the problem about converting ' to ''
|
|
|
|
|
|
Pete O`Hanlon wrote: Colin wrote this article
Thanks for the plug.
|
|
|
|
|
Use parameterised queries.
For example:
INSERT INTO MyTable(Column1, Column2) VALUES(@value1, @value2);
cmd.Parameters.Add("@value1", someValue)
cmd.Parameters.Add("@value2", someOtherValue)
cmd.ExecuteNonQuery()
|
|
|
|