Viewing 15 posts - 4,906 through 4,920 (of 7,610 total)
To get rows from another table that may or may not have a match, you use an OUTER JOIN rather than a "regular" (INNER) JOIN. The columns from the...
August 5, 2015 at 10:25 am
Unfortunately, you have to go back before SQL 2005 for this to be a "useful" script, since ALTER DATABASE provided a vastly better way to do this.
August 5, 2015 at 9:27 am
I believe that's exactly what the code I posted will do. You can uncomment the PRINT statement to verify the views that are being created.
August 4, 2015 at 1:24 pm
SET Ansi_Nulls On;
SET Quoted_Identifier On;
GO
ALTER Procedure [dbo].[sp_ViewCreate]
@TableName varchar(100),
@Dist varchar(20)
AS
Set Nocount On;
Declare @SQLQuery AS nvarchar(4000)
Declare @ParamDefinition AS nvarchar(2000)
Declare @TSN AS nvarchar(20)
Declare...
August 4, 2015 at 9:43 am
Matt Miller (#4) (8/4/2015)
ScottPletcher (8/3/2015)
BSharbo (8/3/2015)
However in this instance there is only the one table.
I...
August 4, 2015 at 8:55 am
ben.brugman (8/4/2015)
ChrisM@Work (8/4/2015)
ScottPletcher (8/3/2015)
You can cancel the identity property by using a union or union all:
select top (0) * into #D from D1 union all select top (0) * from...
August 4, 2015 at 8:51 am
You can do it with a single pass thru the item_categories table -- I renamed the tables to reflect their contents. Data set up first, then the main query...
August 3, 2015 at 2:10 pm
I've actually resorted to having some procs accept a special param value that "tells" the proc just to return the current create table command for its result table. Then...
August 3, 2015 at 1:52 pm
Use sys.columns rather than the information_schema views.
select *
from sys.columns c
where cast(objectpropertyex(c.object_id, 'BaseType') as varchar(2)) = 'u' and c.is_nullable = 1 and c.is_computed = 0
August 3, 2015 at 1:45 pm
BSharbo (8/3/2015)
However in this instance there is only the one table.
I guess I'm still a...
August 3, 2015 at 1:39 pm
ben.brugman (8/3/2015)
August 3, 2015 at 9:11 am
Lynn Pettis (7/31/2015)
ScottPletcher (7/31/2015)
ZZartin (7/31/2015)
ben.brugman (7/31/2015)
Sean Lange (7/31/2015)
July 31, 2015 at 4:52 pm
Main SQL query in the bottom code box. But, I must stress again, to maintain data integrity and drastically help performance, you must:
GET RID OF THE DOPEY AND DANGEROUS...
July 31, 2015 at 4:47 pm
ZZartin (7/31/2015)
ben.brugman (7/31/2015)
Sean Lange (7/31/2015)
July 31, 2015 at 4:10 pm
Lynn Pettis (7/31/2015)
Sean Lange (7/31/2015)
ScottPletcher (7/31/2015)
Technically "usp_" is illogical, since "sp_" stands for "special", but "usp_" wouldn't be meant as "user special".
I would offer that a prefix of any kind...
July 31, 2015 at 2:31 pm
Viewing 15 posts - 4,906 through 4,920 (of 7,610 total)