home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,604 of 19,505   
   Erland Sommarskog to tatata9999@gmail.com   
   Re: sql database creation and its ONLINE   
   07 Aug 09 07:05:25   
   
   16b42177   
   From: esquel@sommarskog.se   
      
   Don84 (tatata9999@gmail.com) writes:   
   > Thank you, Erland, what you suggested makes sense.  So, how does the   
   > following lines of code look to you?   
   > cd "C:\Program Files\"Microsoft SQL Server\90\Tools\Binn"   
   > sqlcmd.exe -S(local)\Sql2005Express -E -iC:\KNBinstall\createmyDB.sql   
   -oresult.log;   
   > select databasepropertyex('myDB', 'Status');   
      
   The last line looks foreign in a batch script. Shouldn't it be in the   
   SQL file? Also, what does the semicolon after -oresult.log do?   
      
   > And since it's a DOS batch script, how would I know the result of the   
   > status check?  Or how could I redirect the "status' check output to a   
   > local file something?   
      
   You can redirect output with -o or the standard DOS > or >>. But why   
   not put all in the same SQL script? I'm not really sure what you are   
   trying to achieve?   
      
   > could use isql.exe instead of isqlw.exe, would that help?   
      
   ISQL is based on DB-Library, and by default it runs with all ANSI settings   
   off. Also, it does not come with SQL 2005. I think SQLCMD is a much better   
   choice. Everything that works with ISQL works with SQLCMD, but not the   
   other way round.   
      
   Speaking of ANSI settings, always use the -I option with SQLCMD to   
   make sure that QUOTED_IDENTIFIER is ON, as SQLCMD for some unexplicable   
   reason as this option OFF by default.   
      
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
   SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca