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 Chriss Miller 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: *

  • Users: wbodger
  • Content: Threads
  • Order by date
  1. wbodger

    Populating query parameters from a temp table

    I am building a system where users can customize queries to pull data out of a transaction history table. The parameters are stored in a temporal table so we can easily track changes CREATE TABLE [dbo].[RedFlagsLimits]( [Id] [int] IDENTITY(1,1) NOT NULL, [CreatedBy] [int] NOT NULL...
  2. wbodger

    Find consecutive numbers 3 or more within a set

    I am trying to find instances where there are 3 or more consecutive check numbers for a given account. For instance, if I have: Account CheckNumber Amount 001234 34546 500 001234 34547 1100 001234 34890 6 001234 35000 1000 001234 35001 1500 001234 35002...
  3. wbodger

    ETL between two non-linked SQL servers

    I have two servers, both running SQL Server 2016 and I need to copy ~12 tables from one server to another, transform (link to a table on destination server and change businessid) and then load into the same server name on new server. My question is: Can I do this in one statement(pull data from...
  4. wbodger

    Constraint to modify value if not unique

    I have a process that does a bulk import where I build a field value given incoming values. Sometimes, ALL of the incoming values are the same, but they are not duplicates. Since this is a bulk import, I don't know of any way to really check if the field value I have built is being built the...
  5. wbodger

    SQL Server 2016 Database Audit Specification

    Hello All! I am working on getting the Failed_Database_Authentication_Group and Successful_Database_Authentication_Group specifications to work, but my changes do not seem to be taking. I disable the audit and the database audit specification, I modify the database audit specification...
  6. wbodger

    Overmatching?

    If I have this data ID Acct Date Amount TranCode ID Acct Date Amount TranCodeType 5 123 7/5/2017 10000 18 76 123 7/5/2017 10000 12 6 123 7/5/2017 10000 18 77 123 7/5/2017 10000 12 7 123 7/5/2017 10000 18 78 123 7/5/2017 10000 12 between two tables (with ID being the first field in each...
  7. wbodger

    updating a subset of data

    I am writing a stored procedure that will insert an order and then assign N serial numbers to that order id and I am wondering if you kind folk can give me any insight into which approach would be better practice (or if I am missing a third option?). The options that I have come up with are...
  8. wbodger

    Returning data from a stored procedure to .Net code

    Wondering if it is better practice to use OUTPUT variables (and am I using them right) to return some values to the calling code CREATE PROCEDURE [dbo].[InsertOrUpdateFormPageData] @FormPageDataId int null, @FormPageId int, @CreatedBy int null, @PostedJSONData nvarchar(max), @UpdatedBy...
  9. wbodger

    Check Constraint to check view (a no-no) or multiple tables (subquery or UDF)

    I have a relationship table which I only want to allow certain entities to enter a record. And those entities could exist in one several places/tables. I have a view that aggregates all of them, but you cannot reference a view in a constraint. So, I was thinking UDF, but now I see that is often...
  10. wbodger

    Selecting only "finished" groups

    OK, let's say that I have a table with 5 columns: ID, Name, ProviderId, Date, Amount Now, let's say that I fill in 4 of the fields and the client has to fill in the fifth field (in this case, ProviderId) Is there a nice way to ONLY select the Name (they will be grouped by name and date) for...
  11. wbodger

    Set Based Thinking

    I have a situation that I have inherited that works, but is slow. Currently, we have a stored procedure that starts off filling a temp table with data. From there it takes a count and then starts a where loop... Inside the where loop a parent record is inserted into a table with a stored...
  12. wbodger

    Using OUTPUTand Table variables

    If I have stored procedure A which calls stored procedure B to do an insert and return the ID of the inserted record, can I create a Table variable in stored procedure B, fill that Table variable using OUTPUT and then retrieve the value in that Table variable in the calling stored procedure (A)...
  13. wbodger

    T-SQL and Error Handling

    OK, I have never been good about putting error handling in my code. I'm not proud of that, I know it is not best practice, so my question is: Will this do what I am thinking it will? I am thinking this code will insert from the raw table into the history table and then, as long as there are no...
  14. wbodger

    Pivot dynamic sql and calculated columns

    I have this static version of a pivot SELECT SBType,[2016-06],[2016-08],[2017-01] FROM ( SELECT [MonthYear] ,Amount ,SBType FROM [dbo].[vw_history] WHERE SN=36521487 AND Amount>0 AND (Direction='Incoming' OR IsIncoming=1) AND IsReturn=0 )src PIVOT ( SUM(Amount) for MonthYear in...
  15. wbodger

    shared data source dynamically chosen with Oracle data source

    I need to create a report that will pull data from our Oracle environment and that environment has 5 distinct servers (all with the same uaername/password) that represent 5 different branches of our business. I know that I can create 5 separate reports with 5 distinct data sources, but I was...
  16. wbodger

    Coalesce thru a hierarchy?

    I have a table with a business structure; Branch (required) Warehouse, ProfitCenter and AccountNumber are optional. I will pass in all four values and I want the first record that matches in a specific order: Branch and AccountNumber Branch and ProfitCenter Branch and Warehouse Branch So, this...
  17. wbodger

    GRidviews, binding, searching and editing

    I have a page with a gridview. I can edit said gridview and everything works fine. I can search said gridview and everything works fine until... If I try to edit the record that I found with my search, then it doesn't actually edit the record that I found because it re-binds to the non-searched...
  18. wbodger

    Conditional formatting and TemplateFields

    OK, I am getting this error Error in execution System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s...
  19. wbodger

    Insert statement driving me crazy

    I am trying to do the simplest thing insert into dbo.tbl_Slipper(Job,JOB_DELIVERY_DATE,QTY_TO_MAKE) select Job,JOB_DELIVERY_DATE,QTY_TO_MAKE from dbo.tbl_Slipper_Test Insert values from one table into another, but I keep getting this Msg 512, Level 16, State 1, Procedure ForInsert, Line 10...
  20. wbodger

    Recursively parse out specific text pattern

    If I have a field with values such as: S/M BOX WITH WO# 00287460 S/M BOX WITH WO# 00287460,00341658,00358941 S/M BOX WITH WO# 00287460,00369852 I want to pull each of those work orders out individually, but I do not know how many there may be in each record. So, how would you walk through...

Part and Inventory Search

Back
Top