SQL Server 2012 :: Create A Table That Would Represent Workload For Each Shop

Mar 19, 2015

I am trying to create a table that would represent a workload for each shop. In order to do that I need to have WorkLoad table and ShopWorkLoad table which is actually just aggregation of WorkLoad.

WorkLoad contains a list of following items:

current orders that are in the process (one select statement)
scheduled orders (another select statement)
expected orders (third select statement) that come through a third-party system

All of this needs to be live. So, for example, as soon as order is added to Order table it should be included in WorkLoad if certain conditions are met. Same goes for scheduled orders (which come from another table). Expected orders will be loaded on a daily bases (based on historical data).

ShopWorkLoad table is aggregation of WorkLoad table.

Currently I did it this way:

Added after insert/update trigger on Order table: when order is created/updated, if it meets certain conditions, it should be inserted in WorkLoad, otherwise remove it from workload if it's in there and doesn't meet conditions

Added after insert/update trigger on Schedule table: when order is scheduled, if it meets certain conditions, it should be inserted in WorkLoad, otherwise remove it from workload if it's in there and doesn't meet conditions

Running daily job that populates WorkLoad table with expected orders based on historical values

Final step is to create an indexed view vShopWorkLoad

My biggest concern is usage of triggers which call pretty complex logic to determine whether item should be added to workload or not.

One other option was to create vWorkLoad view and somehow make it an indexed view but currently I don't see a way of doing that because the query consists of 4 union select statements, below is pseudo example. But even if doing it that way, how to build aggregated indexed view on top of vWorkLoad indexed view?

Third option is to use sql agent job which would run every x seconds (maybe 20) and it would execute all of these queries to populate WorkLoad table with delay of 10-20 seconds, but I am still not sure if this is acceptable to the client.

Fourth option is to create 3 or 4 indexed view where sum of them makes a workload. Then, ShopWorkLoad view would be built on top of these 3 or 4 indexed views, but in this case I don't know how this would affect performance since ShopWorkLoad query would be often queried.

Example of workload pseudo query:

select
WorkLoadType = 'Order in process',
OrderId,
ShopId,
...
from
Order

[Code] ....

View 1 Replies


ADVERTISEMENT

SQL 2012 :: How To Represent Servers CPU Utilization

May 30, 2014

I have multiple instances of SQL 2012 Std Edition on a 40 physical core server.What I have done is the use the Process - SQLServr -% Processor time Stat and divided by 16 ( the max number of Cores Std ed. can use) as a instance level measure. I also use processor object stats to show how busy the server is. How to represent the servers CPU utilization?

View 1 Replies View Related

SQL Server 2012 :: Stored Procedures Compiles Even When There Is No CREATE TABLE For A Temp Table

Feb 11, 2015

i am inserting something into the temp table even without creating it before. But this does not give any compilation error. Only when I want to execute the stored procedure I get the error message that there is an invalid temp table. Should this not result in a compilation error rather during the execution time.?

--create the procedure and insert into the temp table without creating it.
--no compilation error.
CREATE PROC testTemp
AS
BEGIN
INSERT INTO #tmp(dt)
SELECT GETDATE()
END

only on calling the proc does this give an execution error

View 3 Replies View Related

SQL Server 2012 :: Create New Table From Multiple Table?

Feb 19, 2015

I need to create a table from these 2 tables and want all the data. Table 1 has 15000 records and table has around 1000 records.

I have 2 tables.

SELECT [UniqueID]
,[Company]
,[CustID]
,[CustomerName]
,[FiscYr]

[Code] ....

View 5 Replies View Related

SQL Server 2012 :: Create Table From Rows Of A Different Table

Mar 6, 2015

I am using SQL SERVER 2012..I have the following table:

tbtab1
| A | B | C |
| 1 | Pluto | NULL |
| 2 | Pippo | NULL |
| 3 | Rossi | NULL |

I want to creare a new empy table with the columns name contained into the column B of the first table; the following should my results:

tbtab2
| Pluto | Pippo | Rossi |

View 9 Replies View Related

SQL 2012 :: Unable To Create New Table On Server

May 28, 2015

I used SQL Server 2012 Management Studio to create a new table on an 2014 SQL Server instance and got this message: 'This backend version is not supported to design database diagrams or tables'. Does this mean that I have to have SQL Server 2014 Management Studio to create a table on a SQL Server 2014 instance?

View 1 Replies View Related

Represent A Value List As A Table For Outer Join????

Jul 20, 2005

This might not be possible, but on the chance that it can - is there away to do the following:Given a arbitray one dimesional value list:('AALGX','12345','XXXXX','AAINX','AMMXX')Is there a way that I could do a select statement, or similiar, in thevalue list, to get the following resultfield_name-----------AALGX12345XXXXXAAINXAMMXXBecause, what I want to be able to do in the long run is essentiallyperform an outer join on the value list.Something along the lines ofselect value_list.field_name, dbtable.otherfield FROM value_list leftouter join dbtable on value_list.field_name = dbtable.field_nameSo I want all the values in the field list to show up, and anymatching data in the database table that exists, otherwise null.Maybe there is another approach to this???Thanks!KT

View 4 Replies View Related

SQL Server 2012 :: Create Table Syntax Dynamically On Run Time

Apr 19, 2015

I am having 100 of flat files need to load in respective staging table.I want to create table on run time as per filename input.suppose if input filename is ABC then table name should be Staging_ABC if file name is XYZ then it should be Staging_XYZ.Table structure is below need to create at run time

CREATE TABLE Staging_'Filename'(
[COL001] [varchar](4000) NULL,
[Id] [int] IDENTITY(1,1) NOT NULL,
[LoadDate] [datetime] NOT NULL default getdate()
)

View 2 Replies View Related

SQL Server 2012 :: Create Table On Given Data Model Diagram

Jul 27, 2015

I never created table on the basis of Data model diagram . I have to create the 3 table on the basis of given Data model diagram. There are 3 tables

1.md_geographyleveltype
2.md_geographylevel
3.md_geographylevelxref

I have tried to create 2 table but unable to create 3rd table. Need to review the script of first 2 table and to create table script for 3rd table.

View 5 Replies View Related

SQL Server 2012 :: How To Create Staging Table To Handle Incremental Load

Jan 2, 2014

We are designing a Staging layer to handle incremental load. I want to start with a simple scenario to design the staging.

In the source database There are two tables ex, tbl_Department, tbl_Employee. Both this table is loading a single table at destination database ex, tbl_EmployeRecord.

The query which is loading tbl_EmployeRecord is, SELECT EMPID,EMPNAME,DEPTNAME FROM tbl_Department D INNER JOIN tbl_Employee E ON D.DEPARTMENTID=E.DEPARTMENTID.

Now, we need to identify incremental load in tbl_Department, tbl_Employee and store it in staging and load only the incremental load to the destination.

The columns of the tables are,

tbl_Department : DEPARTMENTID,DEPTNAME

tbl_Employee : EMPID,EMPNAME,DEPARTMENTID

tbl_EmployeRecord : EMPID,EMPNAME,DEPTNAME

How to design the staging for this to handle Insert, Update and Delete.

View 9 Replies View Related

What Is The Workload Limit In MS SQL Server?

Jun 13, 2006

Hi, I need some help about a project I'm working on.

I'm working on a project (based on MS SQL Server) that will involve a lot of clients, each one constantly querying the server.
Just to have an idea of the project, I'm talking of about 2000 clients, each one queries the database 3-4 times per second: a total of 6-8000 queries per second.
The database is reached through Internet and every client uses a dedicated DSL connection.

My questions are:
- What is the maximum workload of a Microsoft SQL Server?
- What happens when the server workload reaches 100%? is there a queue? and what happens when the queue is full? is it possible that the server goes out of service due the excess of work?
- What are (more or less) the hardware requirements for such a server?

can anyone help me, at least telling me how to find these answers (web sites, books, ...)

thank you for you support

View 11 Replies View Related

Can't Connect To SQL Server 2005 With Pet Shop 4.0 : No Process At Other End Of Pipe?!

Jun 6, 2006

I downloaded MS Pet Shop 4.0 recently for best-practice training purposes. The installation went smoothly with a SQL Server 2005 backend. At first I had a problem authenticating the mspetshop4 user in the database, but that was solved by fixing some settings with the password policy. Now the mspetshop4 user is authenticated properly, but I came across this error instead:Server Error in '/Web' Application.
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)

Source Error:

Line 216:
Line 217: if (conn.State != ConnectionState.Open)
Line 218: conn.Open();
Line 219:
Line 220: cmd.Connection = conn;


Source File: C:Program FilesMicrosoft.NET Pet Shop 4.0DBUtilitySQLHelper.cs Line: 218

Stack Trace:

[SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +117
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) +619
System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj) +224
System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32 bytesExpected) +113
System.Data.SqlClient.TdsParserStateObject.ReadBuffer() +59
System.Data.SqlClient.TdsParserStateObject.ReadByte() +36
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +181
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +56
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +1083
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +272
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +688
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +82
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +558
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +126
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +651
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +160
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +122
System.Data.SqlClient.SqlConnection.Open() +229
PetShop.DBUtility.SqlHelper.PrepareCommand(SqlCommand cmd, SqlConnection conn, SqlTransaction trans, CommandType cmdType, String cmdText, SqlParameter[] cmdParms) in C:Program FilesMicrosoft.NET Pet Shop 4.0DBUtilitySQLHelper.cs:218
PetShop.DBUtility.SqlHelper.ExecuteReader(String connectionString, CommandType cmdType, String cmdText, SqlParameter[] commandParameters) in C:Program FilesMicrosoft.NET Pet Shop 4.0DBUtilitySQLHelper.cs:127
PetShop.SQLServerDAL.Category.GetCategories() in C:Program FilesMicrosoft.NET Pet Shop 4.0SQLServerCategory.cs:27
PetShop.BLL.Category.GetCategories() in C:Program FilesMicrosoft.NET Pet Shop 4.0BLLCategory.cs:20
PetShop.Web.NavigationControl.BindCategories() in c:Program FilesMicrosoft.NET Pet Shop 4.0WebControlsNavigationControl.ascx.cs:53
PetShop.Web.NavigationControl.Page_Load(Object sender, EventArgs e) in c:Program FilesMicrosoft.NET Pet Shop 4.0WebControlsNavigationControl.ascx.cs:27
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +158
System.Web.UI.BasePartialCachingControl.LoadRecursive() +61
System.Web.UI.Control.LoadRecursive() +158
System.Web.UI.Control.LoadRecursive() +158
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3035


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42Now I'm clueless. What does No process at the other end of the pipe mean? 

View 2 Replies View Related

SQL Server Admin 2014 :: Migration And Testing Workload?

Aug 27, 2014

We are using Sql Server 2008 R2. We are planning to move to 2014 either through in-place o side-by-side. Mostly side-by-side.

Here first we want to test that 2014 and availability groups. First we are doing in dev box to test. Also we need asynchronous replica because just we need to use that as reporting server.

We want to take work load. For the dev boxes, the applications doesn't connect. Then in that case what the people will do.

If We take database backup from prod to that dev and run some queries in the loop and run the trace for some time and do either in-place migration or side-by-side migration and use the same back to restore and doing the running the same queries and compare this trace to previous trace will work?

View 0 Replies View Related

SQL 2012 :: Create A Table

Nov 1, 2014

How to code to create a table in which there are 300 columns and name them as column1, column2...column300? All data type is varchar(255)

View 3 Replies View Related

SQL 2012 :: Create Primary Key On A Table?

Apr 22, 2014

In what situations we can create primary key on a table? I mean what is the minimum no of rows we can prefer to create PK.

View 8 Replies View Related

SQL 2012 :: Create A Table Using Value Of A Variable

May 14, 2014

create a table using the value of a variable

example:
create uspCreateTable
@ NameTable varchar (10)
the
begin
create table @ NameTable (
id int,
Name varchar (20))
end

the intention is to create a procedure that creates tables changing only the name.

View 9 Replies View Related

SQL 2012 :: Selectivity Value Of A Table To Create Index?

Feb 18, 2015

Why should we consider selectivity of a table to create index?

Which is best selectivity value to create an index ?

View 3 Replies View Related

SQL 2012 :: Create Clustered Index On A Very Large Table (500 GB)

May 7, 2014

I need to create a Clustered Index (CI) on a very large SQL Server 2012 database table. This table has about approximately 10 billion rows, 500 GB in size. The job ran for about 20 hours into it and then fails with error: "Out of disk space in tempdb". My tempDB size is 1.8TB, but yet it's still not enough.

Here is my script:

CREATE CLUSTERED INDEX CI_IndexName
ON TableName(Column1,Column2)
WITH (MAXDOP= 4, ONLINE=ON, SORT_IN_TEMPDB = ON, DATA_COMPRESSION=PAGE)
ON sh_WeekDT(Day_DT)
GO

View 9 Replies View Related

SQL 2012 :: Create Table With Both Keys As Foreign (error)

Dec 15, 2014

I'm trying to create a table in Microsoft Server Management Studio 2012. The table has two fields which are both foreign keys.

I created the following:

create table tblRoomEquipment(
RoomID nvarchar(8),
EquipmentType nvarchar(1),
foreign key (RoomID) references tblRoom(ID),
foreign key (EquipmentType) references tblEquipment(Type)
)

Both tblRoom and tblEquipment have the red line error which when I highlight say the they both reference an invalid table!

Both tables are there and have primary keys defined as ID & Type. I have searched around and all I could find was that there maybe a permission problem.

View 6 Replies View Related

SQL 2012 :: Automatically Create Insert Statements For Table Data

Jun 10, 2014

How to create insert statements of the data from a table for top 'n' rows. I know we can create using generate scripts wizard, but we can't customize the number of rows. In my scenario i got a database with 10 tables where every table got millions of records, but the requirement is to sample out only top 10000 records from each table.

I am planning to generate table CREATE statements from GENERATE Scripts wizard and add this INSERT STATEMENT at the bottom.

EX : INSERT [dbo].[table] ([SERIALID], [BATCHID] VALUES (126751, '9100278GC4PM1', )

View 4 Replies View Related

SQL 2012 :: Create A Check Constraint Where Another Table Column Value Is Also Involved

Mar 12, 2015

Table ATable B
AIDBID
Col 1BCol1
Col 2
Col3

I want to put a check constraint on A.col3 that depends on the values of A.Col1, A.Col2 and B.BCol1

How can I achieve this without using function.

View 8 Replies View Related

SQL 2012 :: Generating CREATE TABLE Scripts For Large Number Of Tables

Feb 11, 2014

Other than right-clicking on each individual table in SSMS and generating a CREATE script, is there a simple way to generate CREATE TABLE scripts for tables within a given database?

Background: I have a bunch of tables in one database, and I would like to add tables to a second database that have the same names and basic structures of some of the tables from the first database.

I do not need to transfer any data from the tables, this is a seperate project that will use a similar data structure. I just want to generate the CREATE TABLE scripts for 30ish tables within the first database, and then I'll tweak the scripts as appropriate and run them against the new database.

[URL] ....

View 7 Replies View Related

Best Salesperson Of Each Shop

Nov 14, 2006

Hi!
How do I return best salesperson of every shop? Not working.. return all the best not one per shop. Thank you so much in advance!

SELECT SUM(Cd.Price) AS Sales, Shop.Name, Personnel.Name
FROM Purchase INNER JOIN
Personnel ON Purchase.Salesperson_id = Personnel.Personnel_id RIGHT OUTER JOIN
Shop ON Personnel.Work_id = Shop.Shop_id FULL OUTER JOIN
Cd ON Purchase.Cd_id = Cd.Cd_id
GROUP BY Butik.Namn, Personnel.Name
ORDER BY Sales DESC

View 6 Replies View Related

Distributing DTS Workload

Apr 14, 2008

Suppose I create a DTS package (I am an old timer from SQL Server 2000 days but I suppose with 2005/2008 integration services there is a similar concept of package) which essentially reads data from a set of csv files, transforms it, and loads it into a SQL Server database. There are two scenarios:

i) The transformation involves applying functions on the columns before loading to the database.
ii) The transformation involves joins of data from multiple files.

My question is, can I run this DTS package on a machine which does NOT have SQL server installed for scenario i) and scenario ii) above? The idea is to distribute the actual processing across a set of computers to take off load from the main database server. If it can be done for either case then can u please explain how? Thanks in advance for your help.

View 1 Replies View Related

SQL Server 2012 :: How To Create A DML Trigger

Jan 6, 2015

THe Scenario is We have Tables like parent and Child Table.

Like we have Child Table as Name AcademyContacts,In that we have Columns like

Guid(PK)Not Null,

AcademyId(FK), Not Null,

Name,Null

WorkPhone,Null

CellPhone,Null

Email Id,Null

Other.Null

Since we have given Null to ''Workphone'',''Cellphone '', ''Email ID''.when inserting the data into these table if the particular columns are empty while inserting also the data will get populate into the table.And I need is if these columns are ''Workphone'',''Cellphone'' , ''Email ID'' they cant insert the data into table.Like it must trigger like ''Please enter atleast one of these ''Workphone'',''Cellphone'' , ''Email ID'' columns.

View 5 Replies View Related

Workload Governor And MSDE

Dec 16, 2004

Hi - does the workload governor kick in when more than 8 concurrent operations take place on MSDE as a whole, or does it kick on each database.

Ie. if I have 8 databases within MSDE - and there is 1 operation happening on each one at any given time, will one additional operation on any of the databases invoke the workload governor across ALL databases?

Thanks,

Mark

View 1 Replies View Related

Query/Workload Generator

Jul 23, 2005

Hello,- Is any body aware of a random workload/query generator such as theTPC-H query generator (QGEN) ? I am looking for a query generator thattakes a schema as an input, and produces several queries.I need it mainly for performance evaluation. the generator I am lookingfor should produce SELECT queries, including joins, and not only INSERTINTO, DELETE, UPDATE queries such as the "SqlQueryGenerator" athttp://www.tucows.com/preview/297930ThanksRegards,Abdur-Rahman

View 2 Replies View Related

Workload Governor Removed

Jan 8, 2007

Hello,

I am in the process of porting over an application from Access To SQL implementing SQL Server 2005 Express. My intention is to implement this database on a full time server and upgrade to a full blown version of SQL later. Am I correct in assuming that there is not limit on the number of concurrent connections to SQL Server Express since it was stated that the "Workload Governor" has been removed? Or does something else control the number of users that can be simultaneously connected to the server.

My reason for asking is I have 7 machines that need to access the server. I also have 2 databases that need to be accessed from each machine. If there is no limit, I will keep my databases seperate. However, if there is a limit, I will most likely merge the tables into 1 db.

Thank you,



Robert

View 3 Replies View Related

SQL Server 2012 :: Create Filestream For Filegroup For A DB?

Dec 5, 2014

i have a DB in SQL Server 2008. and i wants to store file in DB.

how can i create filestream for filegroup for a DB in SQL Server 2008.

View 1 Replies View Related

SQL 2012 :: Create Secondary Database On The Server?

Dec 12, 2014

How can I create secondary database on the server i.e. .ndf file?

View 2 Replies View Related

SQL 2012 :: Create Linked Server For Firebird?

Jan 26, 2015

i didn't figure out how to add a firebird linked server via ODBC

my system :

win 7 pro 64
SQL server 2012 express 64
firebird 2.5.3 64
Official ODBC drivers 64

i have created the odbc source without problem, and checked that in visual studio and ssms import data wizard , both show me the data from firebird database but when i try to create a linked server , i have something like this message (the image is from the web)

View 4 Replies View Related

SQL Server 2012 :: Populate Value In Create Sequence?

Jul 29, 2015

I'm looking to see if there is a way to populate starting number for the sequence from a max value of a table.

CREATE SEQUENCE test_seq
AS [int]
START WITH (select max(col1)+1000 from table1)
INCREMENT BY 1
MINVALUE 1
MAXVALUE 2147483647
CACHE
GO

View 3 Replies View Related

How To Access Database With Nameonline-shop??

Mar 13, 2005

i have an database create using webmatrix called online-shop, but when i want to use osql command to back up this database with the
backup database online-shop TO DISK = "c:onlineshop.bak"

then i got the error message said an incorrect syntax near "-"

but i can access this database with comand: osql -E -d online-shop

do i have to add some special string before "-"????? like in linux when you want to access and name with a space in it you have to add an "" before the space

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved