procedure produces an Error 170

From: _M_ (here_at_gone.com)
Date: 08/14/03


Date: Thu, 14 Aug 2003 08:02:36 -0400


This procedure produces an Error 170 (T-SQL syntax error) at or near
"backup". Anyone know why ???

CREATE PROCEDURE dbo.Backup AS
declare @fname varchar(256)
select @fname = 'e:\SQL backup on demand\' +
 db_name() + '_DB_' + convert(varchar(100), getdate(),112)
 + datename(hh,getdate()) + datename(mi,getdate())
--select @fname
backup database StarBldr to disk = @fname
GO



Relevant Pages

  • Re: procedure produces an Error 170
    ... In my previous post, I mentioned "By the way, you will probably have to use dynamic sql to have this thing work as you expect." ... I put the entire backup command into the variable. ... > declare @fname varchar ...
    (microsoft.public.sqlserver.security)
  • Execute a function on file open?
    ... " A mapping to make a backup of the current file. ... WriteBackup() ... silent exe ":w ". ...
    (comp.editors)
  • Re: procedure produces an Error 170
    ... backup database StarBldr to disk = 'e:\SQL backup on ... There is more information about these not very well known tokens in Books ... > declare @fname varchar ... you will probably have to use dynamic sql ...
    (microsoft.public.sqlserver.security)