Viewing 15 posts - 2,161 through 2,175 (of 2,458 total)
GregoryF (8/8/2013)
August 8, 2013 at 11:20 am
Sreejith! (8/8/2013)
Looking for assistance to develop T-SQL code
Requirement is to delete old files from directory & its sub-directories(say F:\Temp\test\), which were placed in directory before 1 week...
August 8, 2013 at 10:45 am
ksrikanth77 (8/8/2013)
My...
August 8, 2013 at 10:35 am
Below is a script that:
1) Creates the sample data
2) Queries the sample data for the desired results
-- (1) Let's build the table structure
DECLARE @source_table TABLE (ID int primary key,...
August 8, 2013 at 10:28 am
You could do something like this:
USE tempdb;
DECLARE @source_table varchar(100)='sys.all_columns',--Source Table
@dest_table varchar(100)='new_table',--destination table (created by SELECT INTO)
@column varchar(100)='is_column_set',--column to swich to NOT NULL
@sql_prep varchar(1000),
@insert_sql varchar(1000),
@alter_sql varchar(1000),
@data_type varchar(100);
SET @sql_prep='IF OBJECT_ID('''+DB_NAME()+'..'+@dest_table+''')'+' IS...
August 5, 2013 at 4:32 pm
I created a stored procedure you can use.
Sample data:
use tempdb;
IF OBJECT_ID('tempdb.dbo.demo') IS NOT NULL DROP TABLE dbo.demo;
CREATE TABLE dbo.demo (col1 varchar(1000), col2 varchar(1000));
WITH tally(n) AS (SELECT ROW_NUMBER() OVER (ORDER...
August 5, 2013 at 9:09 am
sharonsql2013 (8/2/2013)
I am creating a join with some tables and I have been asked table A to be starting point...
August 2, 2013 at 3:54 pm
Sean Lange (8/2/2013)
SELECT cEmail + ';'
FROM #people
FOR XML...
August 2, 2013 at 12:49 pm
You don't need a loop to do what you were trying to do. This would do the trick
DECLARE @emails varchar(5000)=''
SELECT @emails=@emails+';'+cEmail
FROM dbo.people;
This technique, however, can give you data issues... The...
August 2, 2013 at 12:36 pm
This is what I came up with
--SAMPLE DATA
IF OBJECT_ID('tempdb..#table_A') IS NOT NULL
DROP TABLE #table_A;
IF OBJECT_ID('tempdb..#table_B') IS NOT NULL
DROP TABLE #table_B;
CREATE TABLE #table_A (name varchar(20), [address] varchar(20));
CREATE TABLE #table_B (name varchar(20),...
August 1, 2013 at 3:59 pm
I put together a little sample code and a few examples (note my comments) for a couple common scenarios
DECLARE @x TABLE (val varchar(20));
INSERT @x VALUES ('two words'),('two words '),('oneword'),(' leading...
August 1, 2013 at 3:27 pm
You could do something like this:
IF OBJECT_ID('tempdb..#indexInfo') IS NOT NULL
DROP TABLE #indexInfo;
SELECT TOP 0
t.TABLE_CATALOG AS db,
t.TABLE_SCHEMA AS SchemaName,
OBJECT_NAME(i.OBJECT_ID) AS TableName,
...
August 1, 2013 at 9:48 am
TheSQLGuru (7/30/2013)
July 31, 2013 at 3:27 pm
dkschill (7/30/2013)
CREATE TABLE #T (i TINYINT);
GO
INSERT INTO #T
SELECT ABS(CHECKSUM(NEWID())) % 250
GO 1000
;WITH t AS (SELECT i, ROW_NUMBER() OVER (ORDER BY i) AS n,...
July 31, 2013 at 3:04 pm
ChrisM@Work (7/29/2013)
Thanks for the very generous feedback, Mr Kapsicum.If you're interested in how the method works, here's an excellent article by Dwain Camps[/url].
I have nothing to add to this thread...
July 29, 2013 at 3:36 pm
Viewing 15 posts - 2,161 through 2,175 (of 2,458 total)