Viewing 15 posts - 4,021 through 4,035 (of 59,098 total)
Thanks the above query worked great. If I wanted to do a daily extract of records saying start at 00:00 to 11:59 how would that query look?
Thx.
What does that...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 29, 2022 at 1:54 am
Of course, an even better way would be to buy an up-to-date zip code database and do a lookup because not every number from 00000 to 99998 is a valid...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 29, 2022 at 1:38 am
Another possibility is a bit shorter, uses only LIKE instead of LIKE and the LEN() function, and does the same thing is...
IIF(D.Zip LIKE '[0-9][0-9][0-9][0-9][0-9]', d.Zip, '99999') AS...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 29, 2022 at 12:31 am
As a bit of a sidebar, my personal preference for assigning alias names to columns is not to use "expression AS aliascolumnname". I use aliascolumname = expression.
Some people don't like...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 29, 2022 at 12:20 am
Hey Ratbak,
Thanks again, I tried SELECT CAST('A1-'+CustomerID as text) as CustomerID FROM Customers
Get the message. Conversion failed when converting the varchar value 'C25-' to data type int. Any help...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 29, 2022 at 12:09 am
Use the test data you were kind enough to post (nicely done there), here's an answer that uses a CROSSTAB. If you actually DO want NULL to appear, just change...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 28, 2022 at 2:40 am
Perhaps the following but of study will convince you... 😀
https://docs.microsoft.com/en-US/sql/t-sql/queries/select-transact-sql?view=sql-server-ver15
https://www.w3schools.com/sql/sql_select.asp
https://www.techonthenet.com/sql_server/select.php
https://sql-server-tutorial-blog.blogspot.com/2022/01/sql-server-select-statement.html
--Jeff Moden
Change is inevitable... Change for the better is not.
January 28, 2022 at 2:02 am
Don't use functions in a WHERE clause, that's a very bad habit. Yes, SQL Server now generally covers for you with dates/datetimes, but not always, there are...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 28, 2022 at 1:54 am
every night we perform Index maintenance on that database
As a bit of a sidebar, I can almost guarantee that you're doing you index maintenance wrong. Spend more time doing...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2022 at 8:50 pm
I'd clean up the prod problem first. You can use a backup and research to research the other stuff, if you think it's necessary.
Only if you have a place...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2022 at 8:41 pm
Ummmmm... I don't see anywhere where the OP did an EXEC [art].[pCreateArtList_View]... 😉
You DO have to actually execute the stored procedure for IT to create the view.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2022 at 8:33 pm
Don't use functions in a WHERE clause, that's a very bad habit. Yes, SQL Server now generally covers for you with dates/datetimes, but not always, there are some restrictions. ...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2022 at 8:25 pm
Don't rely on the DB_ID() to reference a db. Assume it could change at any time.
If you'll notice, in its system tables, MS stores the db name rather than...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2022 at 8:21 pm
Not sure what you are alluding too but I tried all three options without creating a new database and in each case the id was reused. Only the following...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2022 at 8:18 pm
We are using the sql agent job to take the local drive backup of all the databases on the source and having sufficient permissions on the destination server .xp_CmdShell...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2022 at 2:55 pm
Viewing 15 posts - 4,021 through 4,035 (of 59,098 total)