Showing posts with label hii. Show all posts
Showing posts with label hii. Show all posts

Monday, March 19, 2012

How to return value from dynamic query or set the value

Hii I am Varun i have a problem with the dynamic stored procedure

This is my stored procedure

ALTER PROCEDUREdbo.sp_TimeTableAdjustment1

(

@.TeacherID_OnLeavenumeric(9),

@.DateFromdatetime,

@.DateTodatetime, @.UserIDnumeric(9)

)

AS

declare@.flagas numeric(9)

declare@.yearas varchar(4)

set@.year=(selectbatchfrombatchmasterwhereiscurrent=1andisdeleted=0)

if( @.year=null or len(@.year)=0)

set@.year =year(getdate())

exec('if not exists(select * from timetableadjustments_'+@.year+' where datefrom='''+@.datefrom+''' and dateto='''+@.dateto+''' and teacherid_onleave='+@.teacherid_onleave+')

begin

insert into TimeTableAdjustments_'+@.year+' (TeacherID_OnLeave,DateFrom,DateTo,UserID) values ('+@.TeacherID_OnLeave+','''+@.DateFrom+''','''+@.DateTo+''','+@.UserID+');

end')

else

set@.flag=(selecttimetableadjustmentidfromtimetableadjustments_2007wheredatefrom=@.datefromanddateto=@.datetoandteacherid_onleave=@.teacherid_onleave)

return@.flag

--exec('select timetableadjustmentid from timetableadjustments_'+@.year+' where datefrom='''+@.DateFrom+''' and dateto='''+@.DateTo+''' and teacherid_onleave='+@.TeacherID_OnLeave+'

--')

--return @.flag

--exec('@.flag=select timetableadjustmentid from timetableadjustments_'+@.year+' where datefrom='''+@.DateFrom+''' and dateto='''+@.DateTo+''' and teacherid_onleave='+@.TeacherID_OnLeave+'')

And the problem?...

Friday, March 9, 2012

How to retrieve video file from sql server database

Hi

I uploaded a video file into the sql database converting into binary data.

i have a problem that to retrieve video file(.wmv) from sql server 2000 database and which has to play on media player.

Plz help me any one .

Itz urgent for my website..........

Plz plz Plz Help me Urgent...............

Thanks in Advance

Regards Shiva

Re retrieving the file

Have a look at http://msdn2.microsoft.com/en-us/library/ms952601.aspx
http://www.akadia.com/services/dotnet_load_blob.html
http://www.sqlteam.com/item.asp?ItemID=986

|||

Hi,

I have the same problem. But i'm using oracle database. Similarly i'm retrieving images and place them into the imagebox. But i cant retrive video(as a byte in db) and send it to the media player. How can I do?

Sunday, February 19, 2012

How to restore Sql Server database?

Hi,
I have a backup file in the database server,and I want to restore database using the backup in client.What should I do?

Thanks for any word.

Search Books Online for "RESTORE DATABASE" You can do the restore by sending a SQL Command in ADO.NET.
RESTORE DATABASE {database_name |@.database_name_var}
[ FROM < backup_device > [,...n] ]
[ WITH
[ RESTRICTED_USER ]
[ [,] FILE= {file_number |@.file_number} ]
[ [,] PASSWORD ={password|@.password_variable} ]
[ [,] MEDIANAME ={media_name|@.media_name_variable} ]
[ [,] MEDIAPASSWORD ={mediapassword|@.mediapassword_variable} ]
[ [,] MOVE'logical_file_name' TO'operating_system_file_name']
[,...n]
[ [,] KEEP_REPLICATION ]
[ [,] { NORECOVERY | RECOVERY | STANDBY=undo_file_name} ]
[ [,] { NOREWIND | REWIND } ]
[ [,] { NOUNLOAD | UNLOAD } ]
[ [,] REPLACE ]
[ [,] RESTART ]
[ [,] STATS [=percentage] ]
]