Skip to main content

New answers tagged

0 votes

create_date and modify_date for sys.objects in MSSQL shows same date

In addition to what Yano_of_Queenscastle said, if the object you're trying to verify is a table, the reason create_date is the same as modify_date could be the edition of the specified table using ...
Ronaldo's user avatar
  • 5,636
4 votes

create_date and modify_date for sys.objects in MSSQL shows same date

I assume you are actually talking about sys.objects view, and not sys.sysobjects. It seems like the modify_date is set to create_date until some other changes to table are made (which is pretty common ...
Yano_of_Queenscastle's user avatar
1 vote

Tsql help - doing a large update from CSV file to a table in ssms

You can use https://sqlgenerator.io to convert an excel/csv/json file into a CREATE TABLE and INSERT INTO TABLE SQL statements with the corresponding data. It's a free tool I created as I have to do ...
Ryan Waldorf's user avatar
0 votes

error when re-applying the permissions script into the original database - sql server

Charlieface's anwer is the one I am going to accept, it is very good. The only reason I am posting here, it is because his query did not work on my environment mostly due to COLLATE issues,and I love ...
Marcello Miorelli's user avatar
2 votes
Accepted

error when re-applying the permissions script into the original database - sql server

You need to exclude internal tables using is_ms_shipped = 0. You also need to quote names correctly using QUOTENAME. You need to handle WITH GRANT OPTION correctly. You probably want to add AS ...
Charlieface's user avatar
  • 13.7k
2 votes

Alter table - add a new column as the first column in the table - sql server

I also agree with Sean, but if your actual script is what you have shown, then I would do it in this way. IF OBJECT_ID ('tempdb..#FREE_SPACE_DRIVES','u') IS NOT NULL BEGIN DROP TABLE #...
Jonathan Fite's user avatar
3 votes

Alter table - add a new column as the first column in the table - sql server

Agreed with Sean... But in the interest of answering the question for those who have a use case where column ordinal matters, one way to accomplish your goal is by selecting everything into a new ...
J.D.'s user avatar
  • 38.3k
5 votes

Alter table - add a new column as the first column in the table - sql server

that is all good, but I need the new column to be the first in my table, is there a way to get this done? SELECT server_name, DRIVE, FREESPACE You shouldn't care what the ordinal number of a column ...
Sean Gallardy's user avatar
0 votes

Failover multiple Basic Availability Groups

I use the following script: --Generate failover script. Execute from the PRIMARY DECLARE @FailoverScript NVARCHAR(MAX) = '' SELECT @FailoverScript = @FailoverScript + 'ALTER ...
Petar Samnaliev's user avatar

Top 50 recent answers are included