Showing posts with label together. Show all posts
Showing posts with label together. Show all posts

Friday, February 24, 2012

coping database

I would like to copy my msde database so I can deploy it together with my webpage on another pc. Do I simply just copy the .mdf file or is there another way to extract it?are they on the same network or do you need to carry the db from your home pc to work pc ? take the mdf and the log file when you copy and "attach" it on the destination server.

hth|||they must be on a separate network i must provide database with my asp.net project to the college so I just copy mdf and log file and then open them with database on enother pc? I do not need to extract it then?|||I think you should detach it before copying.
Or you could make a backup and restore it on the other pc.

Regards
Fredr!k|||(1) stop the sql server.
(2) copy the files to the disc (restart the sql server)
(3) paste them into the c\program files\microsoft sql server\..\data\ folder.
(4) in enterprise manager..attach the files.

pretty simple.

hth|||pretty simple if you know all this technical staff i can not see such option as attach
as it is msde i can access it from Matrix or from Web Data Administrator. The only option i can see is import but that requires sql file

Sunday, February 12, 2012

Converting problem (Stored Procedure)

I need to link together string (NT-) and integer variable (1). The value of variable2 should be NT-1. I always got such an error message:

Conversion failed when converting the varchar value 'NT-1' to data type int.

DECLARE @.variable1 int;
SET @.variable1 = 1;

DECLARE @.variable2 varchar(10);
SET @.variable2 = CONVERT(varchar, 'NT-1')+ CONVERT(varchar, @.variable1);

i tried the code that you posted and do not encounter the conversion error.

However, you can simply the code and remove the convert for 'NT-1' as it is a string so you do not need to convert to varchar. And for the @.variable1, you might want to specify the varchar size or it will defaulted to a certain size. (cannot remember what is the default size)
SET @.variable2 = 'NT-1' + CONVERT(varchar(10), @.variable1)