Please help contribute to the Reddit categorization project here

    LeoCurtss

    + friends - friends
    7,100 link karma
    376 comment karma
    send message redditor for

    [–] 1 * 0 DECIMAL = 1 LeoCurtss 3 points ago in SQL

    You need to set the scale and precision of your decimals.

    [–] Looking to break into the industry as a self taught dev, should I put my answers to SQLZoo on my github? LeoCurtss 1 points ago in SQL

    Sure, but it's likely that potential employers will glance over it since the queries have no practical application.

    I would suggest creating an interesting project that utilizes SQL and solves a problem -- even if it has been solved before. Kind of like a programming assignment. This and contributions to open source projects are the type of things interviewers look for on GitHub.

    Tbh, there is soft divide between software development jobs and database development jobs. I can't say that I've ever interviewed a database developer that included a GitHub link on their application. Maybe 1 or 2 if they had software development experience.

    [–] Customized week number with date LeoCurtss 2 points ago in SQL

    datediff(day, '2018-05-01', order_date) / 7 as weekorder

    datediff(day, '2018-05-01', order_date) / 7 + 1 as weekorder

    [–] Just got granted full access to our SQL Server but don’t know where to start. LeoCurtss 1 points ago * (lasted edited 3 days ago) in SQL

    In SSMS, you can right-click SPs in the object explorer and choose "View Dependencies." You can view objects that depend on the SP and objects that the SP depends on. Could be helpful to get a high-level picture.

    But like the other guy said, you'll just need to spend a lot of time familiarizing yourself with the database. If the stored procedures don't insert/delete/update, pull the query from the SP definition and run the individual statements to see what they produce. It would be best if you have the same DB on a dev instance. From the sound of it, that's probably not available to you.

    Also adding to what has already been said: don't be afraid to ask another dev that is more familiar with the code. It's not a sign of weakness. Don't waste time trying to figure something out when someone has already spent the time to do it.

    I'd wager that you are probably in a position where there is no "senior dev" to help out. If that's the case, this is a great opportunity for you to document your findings.

    What's your comfort level is with T-SQL? Do you have a software development background? Just out of curiosity.

    Edit: the SSMS suggestion is only applicable if you're working with MS SQL.

    [–] [MS SQL] Reporting Store Procedure Nightmare LeoCurtss 2 points ago in SQL

    It sounds like you have a good idea of what issues need to be addressed.

    For learning execution plans, here's a great conference talk/presentation from Brent Ozar to get your feet wet:

    https://youtu.be/uwGCPtga06U

    Good luck!

    [–] [MS SQL] Reporting Store Procedure Nightmare LeoCurtss 3 points ago in SQL

    Complicated queries aside: it is bad practice to have an application or report use a single stored procedure for multiple datasets. Split them up into multiple stored procedures ASAP. I would argue that this would be easier to maintain.

    As far as simplifying the queries goes, I would suggest finding common nested queries and creating views to replace them (if the data is not heavily aggregated). If that's not possible or plausible, convert the larger sub-queries to CTEs to make it more readable.

    If you're still struggling with performance, learn how to read an execution plan and troubleshoot from there. Knowing how to work with temp tables, think in sets, reducing logical reads and table scans, indexing, etc. will take you from pro to super-pro.

    If all else fails and the data doesn't need to be live, you could always run a daily or hourly job to store the results in a table and simply SELECT that table for faster results. But since you're working with parameters, this may not be the best solution.

    [–] What are good query applications for MS SQL Server? LeoCurtss 9 points ago in SQL

    The industry standard for querying and administration for MS SQL is SSMS (SQL Server Management Studio). It's free.

    Microsoft is also developing a modernized alternative to SSMS called Azure Data Studio. It doesn't have all the bells and whistles that SSMS has, but they are slowing rolling out features. I still prefer SSMS to Azure Data Studio.

    [–] Nothing to see here LeoCurtss 20 points ago * (lasted edited a month ago) in Simulated

    I agree, it definitely does not behave like realistic sand.

    [–] [SV] [Pics] 50 lbs in 4 months on keto! LeoCurtss 4 points ago in keto

    Congrats! I'm 5'11", so that could be the difference. Plus people's body's are shaped differently. I have very little muscle so that might be part of why my appearance changed so much lol.

    [–] [SV] [Pics] 50 lbs in 4 months on keto! LeoCurtss 3 points ago in keto

    Thanks! No--it's not a ratchet belt but that would be nice! I just had to punch a new hole in the belt. Probably time for a new one...

    [–] Is there anything that can be done about panhandlers with dogs? LeoCurtss 11 points ago in SaltLakeCity

    Good luck in this grand state of Utah. We once called the cops because a puppy (literally a small puppy) had climbed on top of the roof of a pickup truck on the freeway, with the truck driving 70+ mph. They told us that nothing needed to be done since pets are considered "property." So unless the puppy had fallen off and got hurt or put others in danger, law enforcement did not give 2 shits, nor could do they do anything legally.

    [–] Meet the robotics engineer and progressive Mormon challenging Rep. Mia Love for Congress LeoCurtss 3 points ago in SaltLakeCity

    True, but come on. There's an entire section where he talks about how being Mormon is the reason why he wants to run.

    [–] Meet the robotics engineer and progressive Mormon challenging Rep. Mia Love for Congress LeoCurtss 24 points ago in SaltLakeCity

    Any candidate that uses their religious affiliation in their tagline sure as hell is not getting my vote.

    [–] How to group row values by column? LeoCurtss 2 points ago in SQL

    You can either pivot this in SQL, or at the destination (Excel, SSRS, etc.).

    [–] [MS SQL SERVER] Breaking Out a Word from a STRING LeoCurtss 3 points ago in SQL

    You can use a combination of the SUBSTRING and CHARINDEX functions.

    Read here.

    [–] Ways to clean a text file and then store it into SQL Server LeoCurtss 1 points ago in SQL

    It's really impossible to suggest other ways without knowing the contents of said text file.

    Could you give us an example?