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 SkipVought 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. snag56

    Stopping SQL Replication Agents

    You probably need to do the sp_stop_job, as well as the sp_update_job.
  2. snag56

    Copy Table w/ Constraints and Indexes

    Please define "another database". Another SQL Server, or do you mean another DBMS, such as Oracle, MySQL, etc. If you mean another SQL Server (SQL2000), you can use DTS to do the job. If some other flavor of db, then it gets more involved.
  3. snag56

    Querying the activedirectory

    Try these query examples, which assumes that the LDAP (AD) server has been appropriately configured as a SQL linked server: -- select from Sun iPlanet select top 100 * from OPENQUERY(LDAP_Server,'SELECT UserID, UserStatus FROM ''LDAP://ldapserver:389/dc=org1,dc=org2'' WHERE...
  4. snag56

    [b]COPYING STORED PROCEDURES[/b]

    Using Enterprise Manager, I would use a DTS package for this, but it will still need to be tweaked each time to point to the new target database.
  5. snag56

    Can you run a select Statement on a stored Procedure.

    Another convoluted approach would be to establish a linked server definition back to itself (the same server). Then you can do an OPENQUERY to run your sp. The mainline query will them treat the sp results as a temp table, to which you can JOIN, as necessary. However, I wouldn't do this with...
  6. snag56

    Dynamically created a table name in a make-a-table query

    declare @sql varchar(255) set @sql = 'SELECT * INTO MYTABLE' + convert(char(4),DATEPART ( yyyy , GETDATE() )) + RIGHT('00'+convert(varchar(4),DATEPART ( mm , GETDATE() )),2) + RIGHT('00'+convert(varchar(4),DATEPART ( dd , GETDATE() )),2) + ' FROM MASTERFILE' exec @sql
  7. snag56

    using a store proc. in DTS package

    You would use "Execute SQL Task" and specify the sp as follows: EXEC userschema.mystoredproc
  8. snag56

    Suggested methodology for SP update

    How about: begin transaction UPDATE reminder SET reminder.mycolumn = SOT.mycolumn, .... FROM reminder INNER JOIN someothertable SOT ON reminder.matchup_col1 = SOT.matchup_col1 AND reminder.matchup_col2 = SOT.matchup_col2 ... where SOT.status = 'open' INSERT INTO reminder(mycolumn, ....)...
  9. snag56

    DB Relationship

    Assuming the 2 db's are on the same SQL server: select P.Prjcode, A.prjcode from DB1..tblPrj P inner join DB2..prjAccts A on P.Prjcode = A.prjcode
  10. snag56

    Determine Input params at runtime

    Do you mean something like: exec sp_help myproc
  11. snag56

    Sum up columns and rows??

    How about: select sum(i.vchUser3) + sum(i.vchUser5) + sum(i.vchUser6) + sum(i.vchUser7) as total_all from dbo.Incident i
  12. snag56

    Search String........

    SELECT CASE WHEN ISNUMERIC(Code) = 0 THEN CONVERT(int,Left(Code,4)) ELSE CONVERT(int,Code) END AS Test, SUM(amount) FROM test_search GROUP BY CASE WHEN ISNUMERIC(Code) = 0 THEN CONVERT(int,Left(Code,4)) ELSE CONVERT(int,Code) END
  13. snag56

    umlaut /codepage/ OEM

    Also, DTS can be run from command line as: dtsrun /Sserver_name /Uuser_nName /Ppassword /Npackage_name /Mpackage_password Also, see MSDN library article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/coprompt/cp_dtsrun_95kp.asp
  14. snag56

    umlaut /codepage/ OEM

    Try this MSDN library article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_impt_bcp_3vqr.asp
  15. snag56

    left join structure

    There are fundamentally 2 ways to accomplish this, and it looks like you have attempted to use both approaches at once. The preferred (newer) method is : select T1.* from Table1 T1 left outer join Table2 T2 on T1.[ID] = T2.[ID] where T1.[ID] is not null and T2.[ID] is null The older...
  16. snag56

    Find column name containg string

    I believe you have 2 choices: (1) DECLARE @mycol int SET @mycol = 5 SELECT TOP 20 CASE @mycol WHEN 1 THEN Col001 WHEN 2 THEN Col002 WHEN 3 THEN Col003 WHEN 4 THEN Col004 ELSE Col005 END AS mycol FROM mytable OR (2) DECLARE @mycol int SET @mycol = 5 DECLARE @sql varchar(255) SET...
  17. snag56

    Trigger on many rows does not end

    You may want to check whether you are allowing nested triggers, using: EXECUTE sp_dboption 'myDB', 'recursive triggers' As described in BOL, you can add 'TRUE' or 'FALSE' to the above statement, to alter your current setting. This may not be the issue here, but it's worth testing.
  18. snag56

    array stored procedures

    ....And, you can leverage it, in your sp, like this.... SELECT T.* FROM myTable T INNER JOIN fn_Split('1,2,3,4,5,6', ',') AS Q ON T.[ID] = Q.value
  19. snag56

    array stored procedures

    If you are using SQL2000, you could also setup a user-defined function, as described at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlmag01/html/TreatYourself.asp
  20. snag56

    SQL 7 Trace

    If you are describing locking problems, particularly deadlocks, you may not need to resort to a trace (SQL profiler), although this can also be a useful tool. Other tools would be Enterprise Manager (under Management/Current Activity), sp_who, sp_who2, and DBCC INPUTBUFFER. You will need to...

Part and Inventory Search

Back
Top