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 strongm 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. RiddleMeThis

    SProc takes MUCH longer than raw code

    It certainly was, thanks very much riverguy! I renamed the parameter, declared a variable with the old name of the parameter, set the variable to = the parameter, and hey presto!
  2. RiddleMeThis

    SProc takes MUCH longer than raw code

    Could someone please explain to me the difference in how a stored proc runs compared to just raw sql outside of a stored proc? I created a query which creates 2 temp tables and loads them with data, then creates a 3rd temp table, inserts some rows with titles in the first column, and populates...
  3. RiddleMeThis

    Dynamic Columns AND Rows ?

    Got it ! I just had to create a temp table and fill it with data, then drop it, SSRS looks at this temp table and takes the columns from it: CREATE TABLE #Temp1 ( CreateDate VARCHAR(8) ) SET @MonthsCounter = 1 DECLARE @ColumnCreator NVARCHAR(MAX) WHILE @MonthsCounter <=...
  4. RiddleMeThis

    Dynamic Columns AND Rows ?

    Hi Markros, Thanks for the tip, you're right, I hadn't used dynamic pivots before, and had only really brushed on basic pivots, so I have it functional now, producing the correct results. I had to recode the column headers string a couple of times to get it how it has been requested, but it...
  5. RiddleMeThis

    Dynamic Columns AND Rows ?

    Hi Guys, I'm hoping someone can help here because this has caused a lot of head scratching over the past few weeks. I know of the PIVOT function to switch rows into columns, but this means the columns also become rows, therefore the row number is fixed, I would like to create a report that will...
  6. RiddleMeThis

    TAB being represented as a SPACE in the output

    just to clarify, I said i put + '' between each CHAR(9) but on this forum it looks like a plus sign then a double quote mark, its actually 2 singles like ' ' with no space between them :]
  7. RiddleMeThis

    TAB being represented as a SPACE in the output

    Hi Crowley, I ran the full thing from start to finish and found some strange things, but it worked in the end for what I wanted, with some minor tweaking. -SSMS 'Results to Text' worked -SSMS 'Results to Grid' replaced tabs with spaces -SSRS outputted a single space instead of the correct number...
  8. RiddleMeThis

    TAB being represented as a SPACE in the output

    You're right I can now see the tabs correctly when viewing "Results to text", but I need the final output in SSRS, so the results need to be in grid format, SSRS doesn't seem to pick it up in text mode. Thanks for the input though, I never realised it was doing it properly in text mode.
  9. RiddleMeThis

    TAB being represented as a SPACE in the output

    Hi there, I'm trying to insert a TAB into my output in SQL Server 2005 but it just represents it as a SPACE. First I tried the following syntax with the TAB manually put in the string: SELECT 'test1 test2' And also using CHAR(9) like: SELECT 'test1' + CHAR(9) + CHAR(9) + CHAR(9) + CHAR(9) +...
  10. RiddleMeThis

    Why would you use cast over convert?

    When and why would you ever use 'cast' over 'convert'? I presume there is a slight difference in speed as cast doesn't do quite as much as convert, but surely the difference would be so small that it is insignificant. Would you only use cast to make scripts more portable for other SQL...
  11. RiddleMeThis

    Access VBA - date of previous monday or tuesday etc

    You're right i didnt want the time, i never realised this :] Thanks for the followup I get it better now, will look into ammending things as soon as I have time. Cheers :]
  12. RiddleMeThis

    Access VBA - date of previous monday or tuesday etc

    Thanks to everyone who replied, really appreciate it. I tried and tested each method to the best of my understanding, but in the end, went with PHVs way of doing it with input from remou. tbh i didnt really understand dhookom's way, and golum, your way is a really clean cut way of doing it, i...
  13. RiddleMeThis

    Access VBA - date of previous monday or tuesday etc

    Im trying to get the date of the previous day as specified at code level (i have a form for each day of the week so it will change from form to form). Basically I want a variable containing the date of the previous monday for example (but could be any day), including today, so if this is monday...
  14. RiddleMeThis

    Why are GOTO statements bad ?

    Fair enough, thanks for the input guys :)
  15. RiddleMeThis

    Why are GOTO statements bad ?

    Why are GOTO statements bad? I've been writing SQL without any GOTO statements but recently became aware that they can be used in SQL Server 2005, but when I try to research it, people just flame the use of it. Everyone says it's bad practice, and there are almost always more elegant...
  16. RiddleMeThis

    What does N do?

    Ah I see, thanks for that you've cleared things up for me :)
  17. RiddleMeThis

    What does N do?

    I tried the example i gave in the first post with and without the N and i get the same results for both. So why do we need the N? EXAMPLES: SELECT * FROM sys.objects WHERE type IN (N'P', N'PC') SELECT * FROM sys.objects WHERE type IN ('P', 'PC')
  18. RiddleMeThis

    What does N do?

    ok thanks, i would have thought that a string would automatically be converted to the correct string type though. Does any hardcoded nvarchar need to have an N before the actual string then?
  19. RiddleMeThis

    Using dates to join records

    You need to do a subquery in the WHERE clause to select the record with the maximum date. Something like the following (change it around as needed but you should be able to see where im going with it): SELECT * FROM Treatment RIGHT JOIN Episode ON episode.system_code = treatment.system_code...
  20. RiddleMeThis

    What does N do?

    What does N do? I'm looking at some code which I understand for the most part, but if I were writing it I wouldnt use N in it, I don't know what N does so was just wondering if someone could explain it to me please. EXAMPLE: SELECT * FROM sys.objects WHERE type IN (N'P', N'PC')

Part and Inventory Search

Back
Top