O what a place to be I started this Contract as an (Interim) for a new DBA role, for an application support Company last month & all was going well. The User Application is run via Citrix against multiple Hosted Sybase ASA Databases. I introduced SQL 2005 with Reporting Services as a mixed Data Mart Remote Query via ODBC Linked Servers setup. Because they had never had a DBA before the Data I was able to pull from over thirty seperate databases into one and present via Reporting Services has blown them away. And then one day the Senior Support Analyst told me he had put the main most important Sybase Database on a completely seperate domain he had created(with no Trust between the two) , because he was unable to secure the existing domain against unauhorized remote internet intrusion & Viruses. (I never liked the idea that hosted customers were domainusers on the Corporate network) To add insult to injury he then told me to install & maintain another SQL Box on the new domain, OK so far. I logged into the supoposed new box via citrix & then remote desktop, and to my disbelief he had the desktop locked down - no access to control panel or anything - he asked me why i needed access - I told him - he asked me why I need to have reboot priveleges - I told him. So now he's installed 2005 himself in the vain hope I can work without Local Admin privelages or need to unlock the Desktop - he certainly won't give me Domain Admin. I Just cannot believe I'm unable to persuade him to Unlock the Desktop & have even threatened to walk out unless he lets me do my Job. He probably does'nt like me but there can be absolutely no question about my abilities or accessing data that i should'nt. He's basically read a Deny by Default article and expects me to start of as a user with a locked desktop and then request & justify escalating my security from there. Is this possible ? Good Grief :eek: Any ideas what I should do ? Thanks GW
Aim – Take the “One Month Figures”, look at the revenue start date, and calculate the sales by the “Contract Length”, broken down by the year in the “Revenue_State_Date”.
For Example
As the Revenue_State_Date starts on 01/01/2015, you have 12months of full trading in 2015, so you need to calculate 12 months of sales,
This needs to be spread out over the contract length
For eg YearSales Months 2015£2,914,033.3312 2016£2,914,033.3312 2017£2,914,033.3312 2018£2,914,033.3312 2018£1,457,016.676 Total£13,113,150.0054
My query is
SELECT [Total_Contract_Value__c] as TCV, [Contract_Term__c] As Contract_Length, [Revenue_Start_Date__c] as Revenue_State_Date, [Total_Contract_Value__c]/[Contract_Term__c] as One_Month_Sales FROM [FDMS].[Dan].[Raz_Reporting_LCS] where ID = '006a0000015qcGsAAI'
Which produces following results
TCV £13,113,150.00 Contract_Length 54 Revenue_State_Date01/01/2015 One Month Figures £242,836.11
I have a table with 3 fields: Contract_No, Start_Date, End_Date. I need to calculate how many of the days between the Start and End dates fall within each financial year (FY) beginning 1st April and ending 31st March.
So for example if the Contract Start_Date is 26/01/2012 and the End_Date is 20/05/2012 or is null then the number of days for 2012 FY is 49 (counting from 01/04/2012 to 20/05/2012).
If the End_Date is null for the same contract, then the number of days for 2012 FY would be 365.
Since the contract period from Start_Date to End_Date might span more than one or even several FY I need to be able to show this in columns seperately for each FY. What is the best way of achieving this?
The problem I was having regarding re-enable a queue was because it was in another database. I am guessing it did that because the contract and Queues have the same name. I double checked and nothing pointed to that database. I fixed it because I can re-enable the queue in the other database and it is fixed. My question is why did this happen? The other issue I am still having is regarding why the queue got disabled to begin with. I understand that it was because of positioning but do not understand how or why and how to provent it from being disabled.
I solved the previous issue I had and now need to find out how to make it so I have Service Broker running on one machine and the services running on another machine. I mean you can set a connection string to post a message to the service broker but then it will need to respond and the connection string in the method called does not allow you to put a server in the connection string. The other issue is because the stored procedure calls the method in your code based on a namespace and then a method but does not specify a server. I am sure a way exists but am not familiar with it. This is the last piece of the architecture I need to work out before I finish designing the system.
-Shop : list of all shops with an ID_SHOP -Contract : list of all contract with a FK to the shop FK_SHOP. A shop can have multiple contracts
I have a cte where I calculate for each FK_SHOP the maximum contract start date. I now want to join my shop table with the contract table but only for the contracts >= their maximum contract start date.
WITH cteContracts AS ( SELECT FK_SHOP ,ID_CONTRACT ,MAX(cont.DTT_START_DATE) DT_STARTDATE
A contract can many conditions so 1:M...Col 2 is the contract reference and the linking join to contract
Now - a condition related to an contract can have many re-trys and the causes the pk to increment. As you can see there are three conditions related to first attempt and then another three conditions.I want to create an ouput which just reflects the latest conditions when joining back to contract - Is this possible?I have requested to application providers to provide flag, but this will take some time...
I am writing a procedure to drop a specific user's schema only. I select all his/her table name and foreign key in a temp table first and then use a cursor to get the table name and foreign key, and begin drop foreign keys and drop table. However, sql think it is wrong with the syntax like "alter @table_name". Does anyone have a clue, what is wrong with my syntax. Or someone know how to drop one specific user's schema only (Other user may have same table in the database, and you don't want to drop that.
Attached is my scripts: please correct it. Thanks.
CREATE procedure sp_drop_schema @user sysname as
select o.name table_names, o.id table_id, s.parent_obj Key_id, s.name key_name, u.name users_name into #temp1 from sysobjects o inner join sysobjects s on o.id=s.parent_obj join sysusers u on o.uid=u.uid where s.type='f' and u.name=@user
declare cur_f cursor for select table_names, key_name
fetch next from cur_f into @table_name, @key_name while @@fetch_status=0 begin alter table @table_name drop constraint @key_name fetch next from cur_f into @table_name, @key_name end close cur_f deallocate cur_f drop table #temp1
select o.name table_name, o.id table_id, o.uid users_id, u.name users_name into #temp2 from sysobjects o inner join sysusers u on o.uid=u.uid where type='u' and u.name=@user
declare cur_temp cursor for select table_name from #temp2
declare @tab_name varchar (80) open cur_temp fetch next from cur_temp into @tab_name while @@fetch_status=0 begin drop table @tab_name fetch next from cur_temp into @tab_name end close cur_temp deallocate cur_temp drop table #temp2
I wanted to turn off 'Enforce Foreign Key Constrain' using SQL. However, it did not work on the SQL Server 2005 database.
For example, running following SQL in Management Studio, and the result showed that 'Enforce Foreign Key Constrain' property for the newly created constraint was still enabled.
ALTER TABLE [dbo].[Tags] WITH NOCHECK ADD CONSTRAINT [FK_Tags_ChannelID] FOREIGN KEY([ChannelID]) REFERENCES [dbo].[Channels] ([ID])
Does anybody know any way to get around with this problem. It is quite important for my software.
I'm launching the aforementioned statement from one MASTER session windows and I get this message, I am stuck, I though ROLLBACK INMEDIATE go throught any already session open.
Msg 5064, Level 16, State 1, Line 1 Changes to the state or options of database 'GFSYSTEM' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it. Msg 5069, Level 16, State 1, Line 1 ALTER DATABASE statement failed.
I'm not able to get Service Broker to work. I've created the following sample and would excpect to get some data from "PreisanfrageQueue" or "PreisanfrageRequestorQueue". But both they are emtpy.
What do I do wrong?
Regards,
Manfred
create message type Preisanfrage validation = well_formed_xml;
create message type PreisanfrageAntwort validation = well_formed_xml;
create contract PreisanfrageContract ( Preisanfrage sent by initiator, PreisanfrageAntwort sent by target );
create queue PreisanfrageRequestorQueue with status=on;
create queue PreisanfrageQueue;
create service PreisanfrageRequestorService on queue PreisanfrageRequestorQueue ( PreisanfrageContract );
create service PreisanfrageService on queue PreisanfrageQueue (PreisanfrageContract );
create table debug_table; create table debug_table (id int primary key identity(1,1), msg varchar(100));
set @answer = '<preis>1</preis>'; ;send on conversation @conversation message type PreisanfrageAntwort (@answer);
end conversation @conversation;
insert into debug_table(msg) values('3');
alter queue PreisanfrageQueue with status=on, activation ( status=on, PROCEDURE_NAME = PreisanfrageAction, max_queue_readers = 100, EXECUTE AS OWNER );
-- Dialog starten
declare @conversation uniqueidentifier;
begin dialog conversation @conversation from service [PreisanfrageRequestorService] to service 'PreisanfrageService' on contract [PreisanfrageContract];
declare @request xml;
set @request = '<?xml version="1.0" encoding="UTF-8"?><Preisanfrage xmlns="4711101'">http://www.xyz.at/samples/Preisanfrage"><KundenId>4711</KundenId><ProduktId>10</ProduktId><Anzahl>1</Anzahl></Preisanfrage>';
;send on conversation @conversation message type Preisanfrage ( @request );
Some months ago I was playing with Service Broker and everything was ok. But now I just can't get it work. I opened a sample "helloworld" project and still cannot get a message in a target queue. No errors, just empty queues. We have two SQL servers sept CTP on different computers and both give the same issue. It looks like it should have a very simple solution that I cannot come up with.
The following script initializes service broker and sends a message, then selects both target and initiator queues. On my environment it just returns two empty selects.
--Initializing service broker objects use master GO
SET NOCOUNT ON GO
IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'AdventureWorks' AND is_broker_enabled = 1) BEGIN ALTER DATABASE AdventureWorks SET ENABLE_BROKER END GO
USE AdventureWorks GO
IF EXISTS (SELECT * FROM sys.services WHERE name = 'InitiatorService') BEGIN DROP SERVICE InitiatorService END GO
IF EXISTS (SELECT * FROM sys.services WHERE name = 'TargetService') BEGIN DROP SERVICE TargetService END GO
IF EXISTS (SELECT * FROM sys.service_contracts WHERE name = 'HelloWorldContract') BEGIN DROP CONTRACT HelloWorldContract END GO
IF EXISTS (SELECT * FROM sys.service_message_types WHERE name = 'HelloWorldMessage') BEGIN DROP MESSAGE TYPE HelloWorldMessage END GO
IF OBJECT_ID('[dbo].[InitiatorQueue]') IS NOT NULL AND EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[InitiatorQueue]') AND type = 'SQ') BEGIN DROP QUEUE [dbo].[InitiatorQueue] END GO
IF OBJECT_ID('[dbo].[TargetQueue]') IS NOT NULL AND EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[TargetQueue]') AND type = 'SQ') BEGIN DROP QUEUE [dbo].[TargetQueue] END GO
CREATE MESSAGE TYPE HelloWorldMessage VALIDATION = WELL_FORMED_XML GO
CREATE CONTRACT HelloWorldContract ( HelloWorldMessage SENT BY INITIATOR) GO
CREATE QUEUE [dbo].[TargetQueue] GO
CREATE QUEUE [dbo].[InitiatorQueue] GO
CREATE SERVICE InitiatorService ON QUEUE [dbo].[InitiatorQueue] GO
CREATE SERVICE TargetService ON QUEUE [dbo].[TargetQueue] (HelloWorldContract) GO
-- Starting conversation
USE AdventureWorks GO
--BEGIN TRANSACTION GO DECLARE @message XML SET @message = N'<message>Hello, World!</message>'
-- Declare a variable to hold the conversation -- handle.
DECLARE @conversationHandle UNIQUEIDENTIFIER
-- Begin the dialog.
BEGIN DIALOG CONVERSATION @conversationHandle FROM SERVICE InitiatorService TO SERVICE 'TargetService' ON CONTRACT HelloWorldContract;
-- Send the message on the dialog.
SEND ON CONVERSATION @conversationHandle MESSAGE TYPE HelloWorldMessage (@message)
print @conversationHandle
GO
--COMMIT TRANSACTION
GO
SELECT * FROM [dbo].[TargetQueue] SELECT * FROM [dbo].[InitiatorQueue]
SQL Express 2005, MUST work on windows XP Service pack 1, it should not need XP SP 2. Also it should not require windows server 2003 SP1. This is seriously limiting our possibilities as a development company, this is ruining business, ANYONE READING THIS MESSAGE WHO CARES ABOUT THIS ISSUE, AND THAT INCLUDES ANYONE WHO WANTS TO DISTIBUTE SQL EXPRESS, SHOULD ADD THEIR SUPPORT BELOW, COME ON GUYS, PLEASE LET M.S. KNOW HOW WE FEEL ON THIS ISSUE....
I'm trying to get this to work, but seem to be running into a problem.
I've used the wsdl.exe tool to generate a .VB class and added it as a reference to my Script Task
The Web service I want to call from my Script task has a method 'GetAndPublishPriceHistory()'.
When I code my Script task:
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMain
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.
Public Sub Main()
'
' Add your code here
'
Dim MyService As New MyService()
MyService.<Method here>
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
When I type "MyService.", I expect Intellisense to show me the public method GetAndPublishPriceHistory() in my service, but I'm not seeing it. Instead I see GetAndPublishPriceHistoryCompletedEventArgs and GetAndPublishPriceHistoryCompletedEventHandler
So it seems the public methods that I can see when I do a 'http://<my server>/service.asmx?WSDL' are not getting included in my proxy class.
When trying to open the Family.MDF file in this program this error is displayed: Database cannot be upgraded because its non-release version (587) is not supported by this version of SQL Server. How can a current version of this file be obtained? Thank you, Tom
Hi there, I have a stupid question When I want to configure reporting service in a computer it needs Windows SharePoint Service. But When I installed and configured it in my own PC it asked for database server location instead. Anybody have any idea about this?
I'm trying to figure out a solution for posting financial transactions against our Payflow Pro (Verisign) payment gateway (web service) using SSIS. The process I have in my mind goes like this...
1.) Select the appropriate records from our financial system DB.
2.) Iterate through each record and post the pertinent values against the payment gateway web service.
3.) Create log files for successful and failed transactions.
The log files would then be manually imported into our financial system.
1) I have the Beta Preview of Roger Wolter's book on the subject. Has anything major changed from the beta version to the full version (of the book as well as the product)?
2) I want to build a front-end that queues requests for processing that is ultimately done by a standalone console application. The console app knows nothing about SQL Server 2005, so the database will have to fork/execute this app, pass it arguments on its command line, and pick up the result (written to either standard output or standard error) when it finishes. Is this possible with Service Broker? If so, how?
I have a table with a column defined thus: LOCNumber Varchar(100) in atable called Bookdata.If I execute ALTER TABLE BookData ALTER COLUMN LOCNumber varchar(100)on the table, does any work get done on the table and column?Or does SqlServer know that the column is already varchar(100) andnothingneeds to be done?If it does do some work, how do you tell it not to run this as it isalready a varchar(100) column. Right now my program just blindly doesthis ALTER TABLEstatement regardless of any conditions. Is this a potential problem?Thanks for any help.
Hi people,I?m trying to alter a integer field to a decimal(12,4) field in MSACCESS 2K.Example:table : item_nota_fiscal_forn_setor_publicofield : qtd_mercadoria integer NOT NULLALTER TABLE item_nota_fiscal_forn_setor_publicoALTER COLUMN qtd_mercadoria decimal(12,4) NOT NULLBut, It doesn't work. A sintax error rises.I need to change that field in a Visual Basic aplication, dinamically.How can I do it? How can I create a decimal(12,4) field via script in MSACCESS?Thanks,Euler Almeida--Message posted via http://www.sqlmonster.com
I would like to add an Identity to an existing column in a table using astored procedure then add records to the table and then remove the identityafter the records have been added or something similar.here is a rough idea of what the stored procedure should do. (I do not knowthe syntax to accomplish this can anyone help or explain this?Thanks much,CBLCREATE proc dbo.pts_ImportJobsas/* add identity to [BarCode Part#] */alter table dbo.ItemTestalter column [BarCode Part#] [int] IDENTITY(1, 1) NOT NULL/* add records from text file here *//* remove identity from BarCode Part#] */alter table dbo.ItemTestalter column [BarCode Part#] [int] NOT NULLreturnGOSET QUOTED_IDENTIFIER OFFGOSET ANSI_NULLS ONGOhere is the original tableCREATE TABLE [ItemTest] ([BarCode Part#] [int] NOT NULL ,[File Number] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_File Number] DEFAULT (''),[Item Number] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Item Number] DEFAULT (''),[Description] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Description] DEFAULT (''),[Room Number] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Room Number] DEFAULT (''),[Quantity] [int] NULL CONSTRAINT [DF_ItemTest_Quantity] DEFAULT (0),[Label Printed Cnt] [int] NULL CONSTRAINT [DF_ItemTest_Label Printed Cnt]DEFAULT (0),[Rework] [bit] NULL CONSTRAINT [DF_ItemTest_Rework] DEFAULT (0),[Rework Cnt] [int] NULL CONSTRAINT [DF_ItemTest_Rework Cnt] DEFAULT (0),[Assembly Scan Cnt] [int] NULL CONSTRAINT [DF_ItemTest_Assembly Scan Cnt]DEFAULT (0),[BarCode Crate#] [int] NULL CONSTRAINT [DF_ItemTest_BarCode Crate#] DEFAULT(0),[Assembly Group#] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Assembly Group#] DEFAULT (''),[Assembly Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Assembly Name] DEFAULT (''),[Import Date] [datetime] NULL CONSTRAINT [DF_ItemTest_Import Date] DEFAULT(getdate()),CONSTRAINT [IX_ItemTest] UNIQUE NONCLUSTERED([BarCode Part#]) ON [PRIMARY]) ON [PRIMARY]GO
I am using sql server ce.I am changing my tables sometimes.how to use 'alter table alter column...'.for example:I have table 'customers', I delete column 'name' and add column 'age'.Now I drop Table 'customers' and create again.but I read something about 'alter table alter column...'.I use thi command but not work.I thing syntax not true,that I use..plaese help me?
Hi guys, If I have a temporary table called #CTE With the columns [Account] [Name] [RowID Table Level] [RowID Data Level] and I need to change the column type for the columns: [RowID Table Level] [RowID Data Level] to integer, and set the column [RowID Table Level] as Identity (index) starting from 1, incrementing 1 each time. What will be the right syntax using SQL SERVER 2000?
I am trying to solve the question in the link below: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2093921&SiteID=1
Thanks in advance, Aldo.
I have tried the code below, but getting syntax error...
ALTER TABLE #CTE ALTER COLUMN [RowID Table Level] INT IDENTITY(1,1), [RowID Data Level] INT;
I have also tried:
ALTER TABLE #CTE MODIFY [RowID Table Level] INT IDENTITY(1,1), [RowID Data Level] INT;
I have an almost virgin install of SQLExpres running on a WIN2K Pro system.
Have been able to create and connect db to Access 2000 without problem.
Now I wish to extend to remote connections. Using Surface Area Configuration tool, I changed Remote Connections to Local and Remote.
Whenever this setting contains TCP/IP and I try to restart the service I receive the following errors:
System Log:
The SQL Server (SQLEXPRESS) service terminated with service-specific error 10013.
Application Log:
Server TCP provider failed to listen on [ 'any' <ipv4> 0]. Tcp port is already in use.
TDSSNIClient initialization failed with error 0x271d, status code 0xa.
TDSSNIClient initialization failed with error 0x271d, status code 0x1.
Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.
SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.
If I change back to Local Connections Only or Local and Remote using named pipes only, the service starts up again without a problem.
After five days of investigating, researching, reinstalling and waiting I have to ask for help.
I have a VM with SP2013 and SQL Server 2012 SP1. I have installed the powerpivot plugin SP1.But when I run the PowerPivot for SharePoint 2013 configuration tool.