Viewing 15 posts - 1,906 through 1,920 (of 7,614 total)
You don't have to use replace - the string will be converted (implicitly) to an integer for comparison so any leading/trailing blanks will not affect that conversion.
You...
February 9, 2021 at 8:52 pm
You don't have to use replace - the string will be converted (implicitly) to an integer for comparison so any leading/trailing blanks will not affect that conversion.
You can also...
February 9, 2021 at 8:34 pm
In the original version, try putting brackets around the column name "Kolicina". It looks like you might have a non-standard character in the name.
February 9, 2021 at 8:26 pm
I'd stick with temp tables. And it can't hurt -- and could help -- to use a PK in the temp table (or table variable).
DROP TABLE IF...
February 9, 2021 at 8:23 pm
See if these calcs give you results more like what you want.
Edit: Note that the calcs are completely independent of any/all date and language and DATEFIRST setting and will work...
February 9, 2021 at 5:35 pm
But, changing the clustered index without knowing "the rest of the story" may have a devastating impact on other much more important code.
If you build nonclustered indexes as necessary,...
February 9, 2021 at 4:19 pm
If you tell us what you consider to be a "week" -- as we asked for several times -- we could give you code specific to your needs.
I wouldn't rely...
February 9, 2021 at 4:17 pm
Well, obviously, I don't consider it "stupid". Remember, the DELETEs are almost twice a minute. If the table has to be scanned in order to do the deletes, that would...
February 9, 2021 at 3:46 pm
You're welcome. Yeah, SQL requires the alias name (the "AS" is not required, I just like to use it but the "any_name" part is required).
February 8, 2021 at 6:58 pm
You need parentheses to "tell" SQL you're using a subquery in the SELECT:
SELECT * INTO temp_Weekly_Event_Report FROM
(
SELECT
DISTINCT column1 FROM [SQLDatabase].[dbo].[Table] WHERE Event_Source = 1
) AS any_name
February 8, 2021 at 6:46 pm
I strongly object to starting with table structures. Data normalization is a logical process, tables don't exist yet. It's all about the data itself. One should be referencing entities and...
February 8, 2021 at 5:26 pm
They have a query that runs 2400+ times a day using that column to DELETE from the table -- I stick with my recommendation, cluster the table first by that...
February 8, 2021 at 5:20 pm
Always use IFI unless you have disk data that you really can't have anyone else see via some type of hack.
Data pages do not need to be zeroed out before...
February 5, 2021 at 9:04 pm
I think it can be simplified a bit, while also allowing for another value to be found in the future (maybe 'null'?):
SELECT
LongString,
...
February 5, 2021 at 9:02 pm
Most likely that's still best.
Btw, do you know for certain that a given product only occurs once on each order?
February 5, 2021 at 4:18 pm
Viewing 15 posts - 1,906 through 1,920 (of 7,614 total)