Viewing 15 posts - 2,161 through 2,175 (of 2,462 total)
First, welcome to SSC!
If I understand your question correctly you have some VB code that accepts parameters, builds a query based on those parameters then sends that query (ad...
-- Itzik Ben-Gan 2001
August 12, 2013 at 2:58 pm
We will be planning to migrate sql 2005 and sql 2008R2 on new windows 2008R2 server, we have one Replicated DB which ones we are subscribing and we don't have...
-- Itzik Ben-Gan 2001
August 12, 2013 at 2:07 pm
Instead of the case statement you can also do this:
SELECT ISNULL(thing1.name,(ISNULL(thing2.name,thing3.name))) AS name
-- Itzik Ben-Gan 2001
August 12, 2013 at 9:50 am
First, check out the Stairway to SQL Server Replication[/url] by Sebastian Meine.
I am going to set up replication in an OTLP environment. I would like to know what as...
-- Itzik Ben-Gan 2001
August 9, 2013 at 2:06 pm
GregoryF (8/8/2013)
-- Itzik Ben-Gan 2001
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...
-- Itzik Ben-Gan 2001
August 8, 2013 at 10:45 am
ksrikanth77 (8/8/2013)
My...
-- Itzik Ben-Gan 2001
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,...
-- Itzik Ben-Gan 2001
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...
-- Itzik Ben-Gan 2001
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...
-- Itzik Ben-Gan 2001
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...
-- Itzik Ben-Gan 2001
August 2, 2013 at 3:54 pm
Sean Lange (8/2/2013)
SELECT cEmail + ';'
FROM #people
FOR XML...
-- Itzik Ben-Gan 2001
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...
-- Itzik Ben-Gan 2001
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),...
-- Itzik Ben-Gan 2001
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...
-- Itzik Ben-Gan 2001
August 1, 2013 at 3:27 pm
Viewing 15 posts - 2,161 through 2,175 (of 2,462 total)