Generate a alphanumeric id for primary key min 4 digits
hiHow to generate an min 4 characters alphanumeric value to insert as a primary key value along with inserting a new record. The 4 characters should be increased to 5, 6 , 7 when there is a deficit of...
View ArticleCreate table
Hi,I want to create with different columns using varchar datatype.For ExampleS.No Name1 cvcvcv2 xxxxxx3 vvvvvI want to S.No Column set initial...
View ArticleTrying to join two views that have different column types
I want to join view1 and view2 on region and city int columns. Need to break apart View1 varchar field into two Int fields and replace any non-numeric values with zeros.View1 has a single Region_City...
View ArticleSLA Calculation Help needed in Excluding Weekends and Off business hours for...
Hi all,I have to develop a SLA Report. I have already developed using the query in below...
View ArticlePDW Transact-SQL compatibility with SMP
Hi,With PDW AU3, I know stored procedures are supported but some functions in the SMP SQL Server product have not been implemented in SQL Server PDW,Transact-SQL compatibility with SQL Server SMP is...
View ArticleA severe error occurred on the current command - select into
HiI am making a backup of a table before working on the original, but when I try a simple select into statement I receive 'Msg 0, Level 11, State 0, Line 0 - A Severe error occurred on the current...
View ArticleTime limit between running a job?
A little background - I'm trying to create a trigger that logs all logins to a table. While testing, I noticed that if I deleted the table the trigger was trying to call then I could not log on because...
View ArticleLoop thru Status table and start job
I have a STATUS Tbl, that has a field called CompleteDate.Only if the CompleteDate field has TODAYS Today, then I want to proceed with my ssis task, to insert data in some tables. If the CompleteDate...
View ArticleDoes identity value genrator for col is locked in some cases.
http://msdn.microsoft.com/en-us/library/ms186775(v=sql.110).aspxEach new value for a particular transaction is different from other concurrent transactions on the table.q1) Does that mean i insert into...
View ArticleInteger to date in SQL Server 2005
I need to create a loop to pull records that are within a quarter from 2006 to the present. I have created a routine to increment the months and years using integers to get the begin and end dates for...
View Articlehaving trouble with a sql SP statement
I have 3 records grouped by ticket number(it is a field in my table), in 2 of them I have the same stdesc but in the other one I have a description that contains FREIGHT' word. If sttot field >0 and...
View Articlebest way to give tablename in create table statement
hi all,what's the best way to give table name while "create statement" in case of performance.. for eg:create table tablename(id int,name varchar(20))a.) tablenameb.) [tablename]c.) (tablename)d.)...
View ArticleData validation and proper handling
Environment: SQL Server 2008 R2Purpose: Data validation and proper handling. If the loaded data mismatch the following fields data range requirements, it will redirect those data into table A, while...
View ArticleRun 2 queries depending on date?
How can I combine this into one SQL script?SELECT DATE, right('00000000' + SP_ID, case when right(sp_id,1) > '9' then 9 else 8 end) AS VALUE FROM WP_CD WHERE DATE < 06/30/1994 ELSE SELECT DATE,...
View ArticleCan I have a primary key as a non-unique column
Hi all,I have a table with 35 columns and only one column in a not null column. But this column data is not unique. I want to create a primary key with non-unique index, can I don it, if it is not...
View ArticleHow can I get column totals with group breaks
We manually generate a report of file groups and their associated data files each day for each of our databases.For each database we take data from dbcc showfilestats and assemble it into an Excel...
View ArticleThe Parallel Data Warehouse (PDW) features are not enabled.
Tryin to use the Over Clause and receiving the following message:Msg 11305, Level 15, State 10, Line 2The Parallel Data Warehouse (PDW) features are not enabled. Microsoft SQL Server Management...
View ArticleA simple T-SQL Query
I am using SQL 2008. I have following table. HostNameTimestampErrorTypeServer 12014-03-11 00:10:39.387N/W ErrorServer 22014-03-11 01:10:40.387DB ErrorServer 12014-03-11 00:20:39.387N/W ErrorServer...
View Articlehow to hide stored proc and tables schema
hi,(sqlserver 2005 and sqlserer 2008 r2 express) I have to give my database to some body he has his own server, i do not want him to see my stored porcs code and/or name , and tables schema....
View ArticleBest Index
Following is the architecture of the table:CREATE TABLE [dbo].[SMS_Campaign_Attempts]( [ID] [int] IDENTITY(1,1) NOT NULL, [CampaignID] [int] NULL, [OfferProduct] [varchar](50) NOT NULL, [MobileNumber]...
View Article