Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. sqlfable

    Creating snapshots via script.

    markros, Instead of replying with some rude, public vote of inability to resolve some error or make a reply that simply holds absolutely no value why not refrain or post your own suggestion.
  2. sqlfable

    Loading data from Excel

    1. Import the excel sheet into a table. 2. Right the update to the number on the join of the sql object to the imported object. create table tbl1 (fname varchar(20),num int) create table importtbl (fname varchar(20),num int) insert into tbl1 values...
  3. sqlfable

    Loop through query and exec a stored proc for each record

    This is actually sounding more and more like a windows scheduled task and nothing more calling a simplistic exe that is more stable and using less resources from your database server It is actually the most efficient way of utilizing your resources available. SQL Server is not made to do...
  4. sqlfable

    lockinging a table

    The engine already will put an exclusive lock on the table unless you otherwise use hints to prevent such normal engine operations You seem to need a bunch of reading time ;) Try starting here http://www.mssqlcity.com/Articles/General/sql2000_locking.htm
  5. sqlfable

    NUMERIC Scale & Precision required in future versions?

    Your supervisor isn't the best lead. Best advice you can get at this point is don't pick up bad habits from peers. Even if they are in higher positions.
  6. sqlfable

    NUMERIC Scale & Precision required in future versions?

    Technically you are required to have a valid scale,precision. You get around entering it by the defaults. Although I have yet to read of removal of the default values I wish they would to promote better design and coding methods Same rules apply to things like not stating length in varchar...
  7. sqlfable

    proper Save location for SQL stored procedures

    last note on this is if you are writing procedures to run off third party installations (databases you did not design) it is good practice to create a linked database in a sense and create the proc's there. Then use fully qualified names to reference the other db.tables... You can get into...
  8. sqlfable

    SUBSTRING with CHARINDEX

    You can use recursive sql and a bit of FOR XML fun. I owe this to a member here, gmmastros I think. I found it in these forums months ago and it's come in handy replacing slow Split() functions. My attempt at an example ;with results as ( Select cast('<stringVal>' +...
  9. sqlfable

    Union with Variables

    Please read BOL (SQL Server 2005 Books Online ) link ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/607c296f-8a6a-49bc-975a-b8d0c0914df7.htm Specifically the definition UNION Combines the results of two or more queries into a single result set that includes all the rows that belong to all...
  10. sqlfable

    OpenQuery to db2/400

    You will need to use dynamic sql for this. The batch you send to DB2 in openquery will need to be enclosed in quotes also (as the final result) Before going much farther however I would test to make sure the statement works with a static value
  11. sqlfable

    CmdExec job to rename file with yesterday's date

    No problem. If you try the CLR procedure side, use the Move. It would be pretty short.. something like public partial class StoredProcedures { [Microsoft.SqlServer.Server.SqlProcedure] public static void MoveFile(string sfilename, string dfilename) { try {...
  12. sqlfable

    CmdExec job to rename file with yesterday's date

    What version of SQL Server? 2000, 2005 or 2008? 2005+ this is a scripting task using System.IO via an SSIS package. Or call a CLR procedure given the DB is trustworthy on. 2000- I would create a .vbs or .js and call it up from the step. Much easier to error handle.
  13. sqlfable

    displaying an auto-incremented SQL identity column

    >>The secret is to know when to use one and when the other. Amen! >>row_number() is a function that has nothing to do with unicity I think "What more is involved in using the identity column as a key than mere unicity?" gave no end to the thread because it is quite ridiculous to think that...
  14. sqlfable

    How do you use a variable for a column name in the select list?

    This would be so trivial and basic if you designed it correctly with a table holding scores only and related it back to whatever identifier it is you use for the entries. If you are able to alter the schema then you should now before you have more problems down the road. Also if I read...
  15. sqlfable

    displaying an auto-incremented SQL identity column

    >>Do not give any meaning to the identity field except unicity and you are safe. What's the sense in having it then? If this identity is not going to become a strength in you relational integrity by forming it as a key, then why have the wasted space in teh database. Use row_number() if the...
  16. sqlfable

    How to Show a Certain Word from a Field?

    What you are attempting is something much more complex than a simple LIKE. I recommend checking code examples on the net regarding combination usage of PATINDEX and SUBSTRING in TSQL. First couple google hits showed this and this

Part and Inventory Search

Back
Top