Showing posts with label friends. Show all posts
Showing posts with label friends. Show all posts

Saturday, February 25, 2012

About storing and receiving a location from SQL SERVER.....................

hi friends,

i want to store an image in DB. but most of my friends told that, to store an image in web server then store tat location in a DB and access it anywhere. this is for asp.net in C#-code behind. how to do this? i've a table with a text field. then ......? waiting for ur reply.........

note: i need coding. not by using controls. pls...

Hi,

if you want store the image on DB, you can pass it asSqlDbType.Image, and assign a byte array to the field to be saved.

cmd.Parameters.Add("@.Image",SqlDbType.Image, 0,"Image_Data");

DataRow row = new ...

row.Image_Data =File.ReadAllBytes(pathToFile); //assuming you uploaded it and saved it somewhere.

//your update command

Hope this help

Friday, February 24, 2012

about sql server 2005

hi friends,
i'm a new user to sql server 2005 express edition. just now i've installed this server edition. i dont know how to view the server name. i've mentioned that to use windows authentication during installation.
please help me for :
1.how to view the server name in sql server 2005?(it shows only configuration manager and surface area configuration in the all programs menu)

2.how to add new database in this server 2005?(it has no enterprise manager like sql server 2000)

3.when i tried to install MSDE 2000 Release A for SQL SERVER 2005, it throws an error that "A strong SA password is required for security reasons.please use SAPWD switch to supply the same. refer to readme for more details.setup will now exit".

its urgent please........................................

1. The default SQL Server Express name is: [ (local)\SQLExpress ]

2. Download SQL Server Management Studio Express here. A tutorial here.

3. There is a README.TXT file included with the MSDE installation files. You will find instructions about using the command line switches in the README.TXT.

|||marvelous reply.............i didn't expect like this............(for sudden reply)...........thank you......
i've one doubt which is i heard that SQL SERVER 2005 express edition has own inbuilt MSDE 2005. but i've installed the MSDE 2000A. will it override the existing MSDE? and What is the procedure to view the server name?
|||

SQL Server Express can coexists with MSDE. They are very similar (different versions of the same product).

You can verify what instances of SQL Server (MSDE, Express, REgular -they all look the same to the OS) by going to the [Control Panel], select [Administrative Tools], then [Services].

SQL Server(s) will be listed under 'MSSQL'.

If there is one listed as MSSQLSERVER, it's name is the same as your computer name, and it is also know as (local).

Other Instances will be listed as MSSQL$SQLEXPRESS, etc. It's name is the computer name, backslash, and the Instance Name (the part after the dollar sign).

So, SQL Express will be know as: (local)\SQLEXPRESS, or if your computer name is 'Bob, it would be: Bob\SQLEXPRESS

And the same for MSDE and other Instances of SQL Server. It is not at all unusual to find multiple SQL Server Instances -many third party applications install SQL Server Instances for their own use.

About SQL Query

Hi Friends,

I have one Query

select Name from Test1 where ID in (Select ID from (
if ('a' = 'a')
begin
Select DISTINCT ID,Name from Test2
End
) xxx )

and i want the query in same format....but when i execute this it will give an error

Server: Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'If'.
Server: Msg 170, Level 15, State 1, Line 26
Line 26: Incorrect syntax near ')'.

And if drop or remove if, begin ,end functionl;ity then it working fine....

Anyone help me solve this...

ASAP

AshutoshThere is no IF available in Transact-SQL. In general, the replacement for "IF" would be "CASE". But simply using CASE in the statement you provided will not work.

Maybe you could explain what it is you are trying to do, along with data examples...

Terri|||Hi Friend,

Actually i have a only query

if ('a' = 'a')
begin
Select DISTINCT ID,Name from Test2
End

Like this and that query

select Name from Test1 where ID in (Select ID from (
if ('a' = 'a')
begin
Select DISTINCT ID,Name from Test2
End
) xxx )

is generated automatically so error came there that query is not proper i can chage only my query and not the above ...so if any possibility to change that query above one only with if and begin then that problem will solve.....else tell me the other way.....i can change only this query it has 3 if statement so.......

select Name from Test1 where ID in (Select ID from (
if ('a' = 'a')
begin
Select DISTINCT ID,Name from Test2
End
) xxx )

might be u clear what i want now...still if not then i can explan u well

Ashutosh|||> There is no IF available in Transact-SQL.

errr... yes there is, though I agree not in the context you're thinking of. check Books Online.|||Hi Friends,

so how can i solve this problem? no way to solve this??

Ashutosh|||Sorry - I should have been clearer. IF is only available as a flow control command, not within a query.

Ashutosh -- I am still not clear. What is the purpose of the "xxx"? Could you please provide data examples to show the data you have and the result you are looking for?

Terri|||> so how can i solve this problem?

IF should be used so

IFsome criteria
BEGIN
sql statements here
END
ELSE
BEGIN
some other SQL statements here
END

GO

not in the middle of the statement as you've tried to use it. it should enclose complete SQL statements. Check the docs!

Sunday, February 19, 2012

About removal of TimeStamp from DateTime part in TSQL.

Hi friends,
Does anybody could say how to remove the TimeStamp from DateTime part
in TSQL.
Thanks&Regards
Sunil.
Sunil a crit :
> Hi friends,
> Does anybody could say how to remove the TimeStamp from DateTime part
> in TSQL.
> Thanks&Regards
> Sunil.
>
Example, actual date without time :
SELECT CAST(FLOOR(CAST(CURRENT_TIMESTAMP AS FLOAT)) AS DATETIME) AS
"CURRENT_DATE"
CURRENT_DATE
2006-02-15 00:00:00.000
A +
Frdric BROUARD, MVP SQL Server, expert bases de donnes et langage SQL
Le site sur le langage SQL et les SGBDR : http://sqlpro.developpez.com
Audit, conseil, expertise, formation, modlisation, tuning, optimisation
********************* http://www.datasapiens.com ***********************
|||Removing is not possible if you use a timestamp, though you can set it
to 00:00:00, but eleminating is NOT possible. Time is always stuck to
date and vice versa. If you want the two things separated, you have to
use a CHARACTER Storage like VARCHAR, then you can CONVERT the datetime
to any non-containing time-format.
HTH, jens Suessmeyer.
|||Hi
The time part of a datetime will always be stored in the database, even if
you do not specify it when you insert the date it will default the time to
00:00:00. For display purposes you can use the CONVERT function to display
only the date portion of the datetime in a string format. See Books Online
for more information.
John
"Sunil" wrote:

> Hi friends,
> Does anybody could say how to remove the TimeStamp from DateTime part
> in TSQL.
> Thanks&Regards
> Sunil.
>

About removal of TimeStamp from DateTime part in TSQL.

Hi friends,
Does anybody could say how to remove the TimeStamp from DateTime part
in TSQL.
Thanks&Regards
Sunil.
http://www.karaszi.com/SQLServer/inf...dOfTimePortion
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Sunil" <nsunildutt@.gmail.com> wrote in message
news:1140016409.964263.61880@.f14g2000cwb.googlegro ups.com...
> Hi friends,
> Does anybody could say how to remove the TimeStamp from DateTime part
> in TSQL.
> Thanks&Regards
> Sunil.
>
|||Thanks all .
Tibor provided an excellent link.
|||Thanks all .
Tibor provided an excellent link.

About removal of TimeStamp from DateTime part in TSQL.

Hi friends,
Does anybody could say how to remove the TimeStamp from DateTime part
in TSQL.
Thanks&Regards
Sunil.http://www.karaszi.com/SQLServer/info_datetime.asp#GettingRidOfTimePortion
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Sunil" <nsunildutt@.gmail.com> wrote in message
news:1140016409.964263.61880@.f14g2000cwb.googlegroups.com...
> Hi friends,
> Does anybody could say how to remove the TimeStamp from DateTime part
> in TSQL.
> Thanks&Regards
> Sunil.
>|||Thanks all .
Tibor provided an excellent link.|||Thanks all .
Tibor provided an excellent link.

About removal of TimeStamp from DateTime part in TSQL.

Hi friends,
Does anybody could say how to remove the TimeStamp from DateTime part
in TSQL.
Thanks&Regards
Sunil.Sunil a écrit :
> Hi friends,
> Does anybody could say how to remove the TimeStamp from DateTime part
> in TSQL.
> Thanks&Regards
> Sunil.
>
Example, actual date without time :
SELECT CAST(FLOOR(CAST(CURRENT_TIMESTAMP AS FLOAT)) AS DATETIME) AS
"CURRENT_DATE"
CURRENT_DATE
---
2006-02-15 00:00:00.000
A +
Frédéric BROUARD, MVP SQL Server, expert bases de données et langage SQL
Le site sur le langage SQL et les SGBDR : http://sqlpro.developpez.com
Audit, conseil, expertise, formation, modélisation, tuning, optimisation
********************* http://www.datasapiens.com ***********************|||Removing is not possible if you use a timestamp, though you can set it
to 00:00:00, but eleminating is NOT possible. Time is always stuck to
date and vice versa. If you want the two things separated, you have to
use a CHARACTER Storage like VARCHAR, then you can CONVERT the datetime
to any non-containing time-format.
HTH, jens Suessmeyer.|||Hi
The time part of a datetime will always be stored in the database, even if
you do not specify it when you insert the date it will default the time to
00:00:00. For display purposes you can use the CONVERT function to display
only the date portion of the datetime in a string format. See Books Online
for more information.
John
"Sunil" wrote:
> Hi friends,
> Does anybody could say how to remove the TimeStamp from DateTime part
> in TSQL.
> Thanks&Regards
> Sunil.
>

About removal of TimeStamp from DateTime part in TSQL.

Hi friends,
Does anybody could say how to remove the TimeStamp from DateTime part
in TSQL.
Thanks&Regards
Sunil.http://www.karaszi.com/SQLServer/in...idOfTimePortion
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Sunil" <nsunildutt@.gmail.com> wrote in message
news:1140016409.964263.61880@.f14g2000cwb.googlegroups.com...
> Hi friends,
> Does anybody could say how to remove the TimeStamp from DateTime part
> in TSQL.
> Thanks&Regards
> Sunil.
>|||Thanks all .
Tibor provided an excellent link.|||Thanks all .
Tibor provided an excellent link.

About receiving an image from SQL server 2000 and displaying it in aspx page..............

hi friends,

i need a code for storing and receiving an image to/fro SQL SERVER 2000 (in C#). i had searched some sites, all are in VB for windows forms not for website. finally i got a code from some site. it is working for storing purpose. not working for receiving purpose. the code for receiving and displaying purpose is

(in a fresh page)

privatevoid Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
MemoryStream stream =new MemoryStream ();
SqlConnection connection =new
SqlConnection (@."server=INDIA\INDIA;database=iSense;uid=sa;pwd=india");
try
{
connection.Open ();
SqlCommand command =new
SqlCommand ("select Picture from Image", connection);
byte[] image = (byte[]) command.ExecuteScalar ();
stream.Write (image,0, image.Length);
Bitmap bitmap =new Bitmap (stream);
Response.ContentType ="image/gif";
bitmap.Save (Response.OutputStream, ImageFormat.Gif);
}
finally
{
connection.Close ();
stream.Close ();
}
}


what s the problem is.......i'm getting an exception at Bitmap instantiation.

(i.e Bitmap bitmap =new Bitmap (stream);)

exception is "Parameter is not valid"

what is the problem with that coding? was it correct? do u have any code for this in C#? if so, pls provide that.....help me......pls..........

Have a look at

http://www.codeproject.com/aspnet/NetPix.asp This article explains an ASP.NET application to view and share photos online.
|||

i got the answer from

http://www.ftponline.com/vsm/2002_07/online/hottips/esposito/

in that program setoffset =0;(they have coded as 78,it will not work.) this is very very important.......now i'm so happy........after a month i got the answer.....