Viewing 15 posts - 1 through 15 (of 607 total)
select
'bcp "select '+STRING_AGG(COLUMN_NAME,',')+' from [db].dbo.'+name+'" queryout "G:\Test-Bak\Data\db'+'_Load\'+name+'.txt" -S"server" -U"sa" -P"password" -n -c -t^| -T -o"G:\Test-Bak\Log\db\'+name+'_log.txt"'
table_name--,name,COLUMN_NAME
from tbl_column_length C left join sysobjects S on C.TABLE_NAME=S.name
where type='u'...
November 16, 2022 at 1:19 pm
As the length of the "@SQL" variable exceeds the character limits of PRINT AND ?, what command can be used to copy out the complete SQL script contained in @SQL?
March 29, 2021 at 11:09 am
December 9, 2018 at 2:10 am
Yet another split function.....
While I do appreciate the effort, there are millions of these with extensive research on performance comparisons between the various options. This horse has been flogged...
December 6, 2018 at 6:31 am
This is very good info to have because it can bite you sometimes.
True story: Working at a top insurance company I discovered that an I.T. admin group had...
August 3, 2018 at 3:30 am
CREATE TABLE #t
(RowNo INT IDENTITY(1, 1),
ID INT,
Debit DECIMAL(10, 2),
Credit DECIMAL(10, 2));
INSERT INTO
#t
VALUES
(13334357, 209.67, 0),
(13334357, 0, 209.67),
(13334357, 1000,...
February 6, 2018 at 2:49 am
Get the most recently added computer from active directory. Strip the alpha characters so only the number is left. Increase the number.
February 6, 2018 at 2:28 am
DECLARE
@dbname SYSNAME = 'master.sys.databases',
@Searchname SYSNAME = 'model';
DECLARE @sqlCommand NVARCHAR(MAX);
SET @sqlCommand = 'SELECT * FROM ' + @dbname + ' WHERE name = @Searchname';
February 6, 2018 at 2:16 am
DECLARE
@Email SYSNAME = 'me@domain.co.xx',
@Query NVARCHAR(MAX) = N'DBCC CHECKDB(' + QUOTENAME(DB_NAME()) + ') WITH ALL_ERRORMSGS, NO_INFOMSGS';
EXEC msdb..sp_send_dbmail
@profile_name = 'ProfileName',
@recipients = @Email,
@subject =...
February 6, 2018 at 2:09 am
Did you know that real Football is played with a round ball. (I'm just saying).
** grabs popcorn **
February 5, 2018 at 4:53 am
I didn't say there must be a join condition, just pointing out that there is no condition, which the OP may or may not be aware of 😎
February 5, 2018 at 12:40 am
There is a missing select, and no join condition for t1 and t2.SqlCommand cmd = new SqlCommand("
select
DATENAME(month, GETDATE()) AS [month],
month(getdate()) as [monthnumber],
t1.Actual,
t2.Target
February 4, 2018 at 5:00 am
SQL Server always stores XML internally as UCS-2 so it is impossible for SQL to generate a UTF-8 encoding header
https://technet.microsoft.com/en-us/library/ms187107(SQL.90).aspx
February 1, 2018 at 3:12 am
Viewing 15 posts - 1 through 15 (of 607 total)