I am writing a query now where I only want to get participants in the 112 service code only but this query I have is giving me other service codes as well when I have it set to 112. How can I fix this just so i can get this 112 service code only.
declare @bgDte smalldatetime
declare @enDte smalldatetime
declare @rgn char(2)
set @bgDte = '2013-01-01'
set @enDte = '2013-04-30'
set @rgn='05'
1. PhoneID is nothing but the participant in the call. PhoneID = 1 is twice from above. Which means 2 particpants (Same call )with 2 numbers with their callstarttime and callendtime. Similarly for PhoneID =2, there are 4 participants. And the list goes on for a day and then for a month.
2. For example a phone call P1 with 2 participants is going on for a particular day. We should not consider the same phone call having 2 participants involved. So that the concurrency would be 2. We have to ignore that here.
3. Only to be considered is other Phone calls for that day. Lets say P1 having call with 2 participants, P2 having some 4 participants which fall in the time period of P1. Then we should consider P1 and P2 the common period
4. In order to find number of concurrent calls happened for a day basing on callstarttime and callendtime. What would be the query?
5. Should consider the Timeperiod or the bucket with 1 hour as the period.
6. A Phone Call P1, Phone Call P2, should have matching (common) time ( keeping all the scenarios) is required for this query.
Result for Concurrent calls for a day should be like below. Should get all the concurrent connections happened for a particular day.
Date|TimePeriod/Bucket(hr part)|Concurrentconnections| Jan-01-2015|01 to 02|3 Jan-01-2015|11 to 12|2 Jan-02-2015|04 to 05|5 Jan-02-2015|12 to 13|13 ........
ii) So once the above is achieved.
Have to find the Maximum concurrent connections for day from the above.
For below Maximum Concurrent connections are '3' Date|TimePeriod/Bucket(hr part)|Concurrentconnections| Jan-01-2015|01 to 02|3 Jan-01-2015|11 to 12|2
Hence the Result for Maximum Concurrent Connections would be
Date|TimePeriod/Bucket(hr part)|MaxConcurrentconnections| Jan-01-2015|01 to 02|3 Jan-02-2015|12 to 13|13 .............
I have a microsoft report that uses a dll to calculate a value. If I hard code the value, my report shows it. My method in the dll is connecting to a database in order to calculate a result. However, in order to connect to the database, I am using Microsoft.Practices.EnterpriseLibrary.
The error in my report is: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I have added a reference in the report to the EnterpriseLibrary but this has not made a difference.
I have my Sql server 2005 running perfectly (until yesterday) on vista. But today when I tried to connect to the server I get error 3417 meaning my master database needs rebuilt or repaired.
I tried all sort of techniques I found on internet like checking if my data files in data dir are not compressed and for the SQL Server Servies it logs on local account with interact with desktop checkbox checked. But no luck.
I tried to use setup.exe in my installer CD to rebuild master database but it seems the cmd doing nothing. To rebuild, I use the following command “start /wait setup.exe /qn INSTANCENAME=<instance> REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=<New SA Password>�. This cmd runs but due to some reason my master db is not being repaired. Ideally, I should see recent date change for this file.
Please advice how can I connect back to my server again making sure my databases are not lost.
Hello! I´m trying to setup a Report Server on my SQL 2005 server. In Reporting Services Configuration Manager I get an error when i try to create the Web Sevice Identity
ReportServicesConfigUI.WMIProvider.WMIProviderException: An unknown error has occurred in the WMI Provider. Error Code 80070003 at ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.SetWebServiceIdentity(String applicationPool)
The default website contains an office sharepoint 2007 beta solution if that could cause the error..
I have SQL 2005 Express installed. When I try to apply service pack 1 to this by going through the upgrade process, I get an error ' THe installer has encountered an unexpected error. The error code is 2259. Table(s) update failed'
To overcome the inability to manage the sheet tab names when exporting from Reporting Services to Excel, is there anyway to include a short macro with the exported Excel workbook to Auto_Run macro when the Excel file is opened to rename the tabs?
I have Vista x64 and I had been fighting SQL Server for a few days and yesterday I decided for reinstallation. Unfortunately now I am not able to instal the server back!
Each time I got the following error (it refers to SQL Server service):
Code Snippet <Func Name='LaunchFunction'> Function=Do_sqlShutDownRANUInstance <Func Name='GetCAContext'> <EndFunc Name='GetCAContext' Return='T' GetLastError='203'> Doing Action: Do_sqlShutDownRANUInstance PerfTime Start: Do_sqlShutDownRANUInstance : Tue Sep 04 23:32:16 2007 <Func Name='Do_sqlShutDownRANUInstance'> Service SQLEXPRESS with parameters '' is being started at Tue Sep 04 23:32:16 2007 Unable to start service (3) Error Code: 0x80070003 (3) Windows Error Text: System nie może odnaleźć określonej ścieżki. Source File Name: sqlsetuplibservice.cpp Compiler Timestamp: Wed Jun 14 16:29:04 2006 Function Name: sqls::Service::Start Source Line Number: 316
Setting status of unmanaged components and removing unmanaged resources
Error Code: 3 MSI (s) (F4:E4) [23:32:24:490]: I/O on thread 3716 could not be cancelled. Error: 1168 MSI (s) (F4:E4) [23:32:24:493]: I/O on thread 788 could not be cancelled. Error: 1168 MSI (s) (F4:E4) [23:32:24:493]: I/O on thread 2948 could not be cancelled. Error: 1168 MSI (s) (F4:E4) [23:32:24:493]: I/O on thread 4392 could not be cancelled. Error: 1168 MSI (s) (F4:E4) [23:32:24:493]: I/O on thread 5048 could not be cancelled. Error: 1168 MSI (s) (F4:E4) [23:32:24:495]: I/O on thread 4464 could not be cancelled. Error: 1168 MSI (s) (F4:E4) [23:32:24:495]: I/O on thread 4992 could not be cancelled. Error: 1168 MSI (s) (F4:E4) [23:32:24:495]: I/O on thread 4768 could not be cancelled. Error: 1168 MSI (s) (F4:E4) [23:32:24:497]: I/O on thread 3004 could not be cancelled. Error: 1168 MSI (s) (F4!4C) [23:32:24:497]: Product: Microsoft SQL Server 2005 -- Error 29503. The SQL Server service failed to start. For more information, see the SQL Server Books Online topics, "How to: View SQL Server 2005 Setup Log Files" and "Starting SQL Server Manually." The error is (3) System nie może odnaleźć określonej ścieżki. . Error 29503. The SQL Server service failed to start. For more information, see the SQL Server Books Online topics, "How to: View SQL Server 2005 Setup Log Files" and "Starting SQL Server Manually." The error is (3) System nie może odnaleźć określonej ścieżki. . <Failure Type='Fatal' Error='3'> <EndFunc Name='LaunchFunction' Return='3' GetLastError='203'> MSI (s) (F4:80) [23:32:24:507]: User policy value 'DisableRollback' is 0 MSI (s) (F4:80) [23:32:24:507]: Machine policy value 'DisableRollback' is 0 Action ended 23:32:24: InstallFinalize. Return value 3. MSI (s) (F4:80) [23:32:24:512]: Executing op: Header(Signature=1397708873,Version=400,Timestamp=925154312,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1) MSI (s) (F4:80) [23:32:24:512]: Executing op: DialogInfo(Type=0,Argument=1033) MSI (s) (F4:80) [23:32:24:513]: Executing op: DialogInfo(Type=1,Argument=Microsoft SQL Server 2005) MSI (s) (F4:80) [23:32:24:514]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1]) MSI (s) (F4:80) [23:32:24:516]: Executing op: ActionStart(Name=Do_sqlShutDownRANUInstance.D20239D7_E87C_40C9_9837_E70B8D4882C2,Description=Running action to shutdown instance(Run As Normal User),) MSI (s) (F4:80) [23:32:24:517]: Executing op: ProductInfo(ProductKey={C3F5DBA5-ABFC-443E-AA60-928223AADF53},ProductName=Microsoft SQL Server 2005,PackageName=sqlrun_sql.msi,Language=1033,Version=151129058,Assignment=1,ObsoleteArg=0,ProductIcon=ARPIcon.ico,PackageMediaPath=Setup,PackageCode={08AD0897-0300-4F7D-A3CC-A0CCEDD42E0D},,,InstanceType=1,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3) MSI (s) (F4:80) [23:32:24:518]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,) MSI (s) (F4:80) [23:32:24:519]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWAREMicrosoftWindowsCurrentVersionSharedDLLs,,BinaryType=0,) MSI (s) (F4:80) [23:32:24:520]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWAREMicrosoftWindowsCurrentVersionSharedDLLs,,BinaryType=0,) MSI (s) (F4:80) [23:32:24:520]: Executing op: ComponentUnregister(ComponentId={68C6D258-77E0-11D5-8528-00C04F68155C},ProductKey={C3F5DBA5-ABFC-443E-AA60-928223AADF53},BinaryType=0,) MSI (s) (F4:80) [23:32:24:520]: Executing op: ComponentUnregister(ComponentId={68C6D257-77E0-11D5-8528-00C04F68155C},ProductKey={C3F5DBA5-ABFC-443E-AA60-928223AADF53},BinaryType=0,)
Hi i tried to install the Microsoft SQL Server 2005 Express Edition Service Pack 2 but was unable to do so. I got an error message saying: Error Code: 0x2B22
I went through what the message said, but i was unable to solve the problem. Below is the summary of the problem. Please help me solve it.
Time: 05/19/2007 12:32:24.781 KB Number: KB921896 Machine: DET-NB0631262 OS Version: Microsoft Windows XP Professional Service Pack 2 (Build 2600) Package Language: 1033 (ENU) Package Platform: x86 Package SP Level: 2 Package Version: 3042 Command-line parameters specified: /quiet /allinstances Cluster Installation: No
********************************************************************************** Prerequisites Check & Status SQLSupport: Passed
********************************************************************************** Products Detected Language Level Patch Level Platform Edition Express Database Services (SQLEXPRESS) ENU RTM 2005.090.1399.00 x86 EXPRESS Express Database Services (SQLExpress) ENU SP2 x86 EXPRESS
********************************************************************************** Products Disqualified & Reason Product Reason Express Database Services (SQLEXPRESS) Unable to start service
********************************************************************************** Processes Locking Files Process Name Feature Type User Name PID
********************************************************************************** Product Installation Status Product : Express Database Services (SQLEXPRESS) Product Version (Previous): 1399 Product Version (Final) : Status : Not Applied Log File : SQL Express Features : SQL_Data_Files,SQL_Engine,SQL_Replication,SQL_SharedTools Error Number : 11042 Error Description : Unable to start service ---------------------------------------------------------------------------------- Product : Express Database Services (SQLExpress) Product Version (Previous): Product Version (Final) : Status : Not Applied Log File : SQL Express Features : Client_Components,Connectivity,SDK Error Number : 0 Error Description : ----------------------------------------------------------------------------------
********************************************************************************** Summary Unable to start service Exit Code Returned: 11042
I am a beginner and looking for some help. I have a database with just one column (some names). That is the primary key aswell. Because I want the names to be unique.I used a grid view control to display the data and included the insert functionality in the grid view by using some code and the part of the code that does the insert is 1 public static void Insert(Categories category) 2 { 3 string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; 4 using (IDbConnection cn = new SqlConnection(connectionString)) 5 { 6 cn.Open(); 7 8 IDbCommand cmd = new SqlCommand(); 9 10 cmd.CommandText = "INSERT INTO Categories (CategoryName) VALUES " + 11 "('" + category.CategoryName + "')"; 12 13 cmd.Connection = cn; 14 cmd.ExecuteNonQuery(); 15 } 16 } Question: when someone tried to enter a new name which already exists in the database it throws an error page which is what I want but is there a way to be able to display the user a message sayin g that he/she has entered a name that already exists and hence they need to try a different name? instead of the ugly error page? Thank you in advance,Prasad.
Hi, I need to bind to dropdown list, the conference names from the last one to the first one. I'm using following query, the problem is it returns the conference names the number of dates created, since it's one table with all data I can't change it now. Is there a way to get the names one time for each name without repeating?
string Sql = "SELECT DISTINCT conference_name,creation_date FROM Conference ORDER BY creation_date DESC"; SqlDataAdapter da = new SqlDataAdapter(Sql, myConn); dataSet = new DataSet(); da.Fill(dataSet); ddlConfName.DataTextField = "conference_name"; ddlConfName.DataSource = dataSet.Tables[0]; ddlConfName.DataBind();
Forgive me if i'm being really stupid but... we have an accounts package (Exchequer) using sql. I would like to use the tables in sql to interrogate the db further. However my numeric fields e.g. Credit Limit are split into 2 fields. One is a smallint type and one is an integer. How do I combine these fields to get an accurate value? Thanks
Hello, I receive this error "The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications." I attach the database in Management Studio to query and enable the broker using the scrip below but to no avail. ALTER DATABASE DataName SET ENABLE_BROKER ‘''<<------successfulandSELECT is_broker_enabled FROM sys.databases WHERE name = 'Database name' ‘'''<<-------value is 1 Global.asax ... Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) System.Data.SqlClient.SqlDependency.Start(ConfigurationManager.ConnectionStrings("dataConnectionString1").ConnectionString) End Sub...Web.config ... <connectionStrings> <add name="dataConnectionString1" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|jbp_data.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /> <add name="ASPNETDBConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /> </connectionStrings>... Hope you could help. cheers,imperialx
I keep getting the error "Invalid attempt to read when no data is present" when trying to query a table in my SQL DB. I have checked and rechecked and the table name and column names within it are spelled correctly. There are only three records in the database, they all have data in them, and the code in Country.Text precisely matches the data in the Country field in one of the records.
It's worth mentioning that when I use Visual Studio 2005's little direct SQL query tool to build and run the following SQL statement that it works properly:
I am perplexed. Any ideas anybody...here is the code...?
Dim SelectSQL_Countries As String SelectSQL_Countries = "SELECT * FROM data_Countries " SelectSQL_Countries &= "WHERE Country='" & Country.Text & "'"Dim con_Countries As New SqlConnection(ConfigurationManager.ConnectionStrings("MySiteMainDB").ConnectionString) Dim cmd_Countries As New SqlCommand(SelectSQL_Countries, con_Countries)Dim reader_Countries As SqlDataReader Try con_Countries.Open() reader_Countries = cmd_Countries.ExecuteReader()StateID.Text = reader_Countries("WordForState") reader_Countries.Close()Catch err As Exception lblResults.Text = err.Message Finally con_Countries.Close() End Try
I have a database and would like to retrieve specific data via queries. This database is also connected to an ASP .Net 2.0 application to be the front end. Ive created the query in the database. Would you recommend i use parameter names to retrieve the data via code or should i have the query within my code to retrieve the data? Thanks
HI all, I got a tsql that needs to be simplified. Select * from Table1 where condition1 and id not in ( Select id from table1 where condition2 and id in ( Select id from Table1 where condition1 ) ) basicly all records thats in condition1 but that doesnt have condition2 but limited to condition1. I'm probably maken this to complicated. but im tired and im losing time just on one stupid query. Thanks for the help.
I know this is a very simple problem however I've literally just begun learning about SQL and this is the first ever code i've created using the language.
The error is:
Msg 102, Level 15, State 1, Line 30 Incorrect syntax near ')'. Located on line containing "create table Trailer_Type"
Ok, so im pretty much finished writing my forum web page. However to display things like how many replies each thread has and who replied last, i need to perform a query in the code file. Im guessing its simple enough but i cant get the syntax for actually performing any query. I already know the sql syntax like select * from all that stuff but how do i get do something like: Dim x as integer = sqlQuery("Select count(*) FROM ...") Currently i have it all working by creating a table and making it invisible and just pulling data from the table but thats sloppy and pretty ineffecient if i databind a table for every single topic name.
I've created a stored procedure which inserts values into a table and upon successful execution the RC column gets returned along with the Identity value (I'm using SELECT SCOPE_IDENTITY()), but I don't want to RC column, I only want to get the Id number of the current row. I'm doing this using the Query Analyzer.
Is there a way to suppress the RC column? I have run the same query on different servers and the RC col doesn't show up. I only want the ID value to put into an ASP.NET page.
While testing different query methods from ASP.NET (Output parameter, Return_Value, etc) did I set a flag within SQL Server?
i have a number of business programs. Each program is started anew at the beginning of each fiscal year. each program has a number of goals and customers subscribe to the goals.
i have to pull all this info out of the database.
i have a cursor that gets the first program, inside this program i have a cursor that gets the first period, and inside that i have a cursor that gets the info on each goal.
program cursor
{
period cursor
{
goal cursor
}
}
}
}
this takes ages ( hours and hours ) to run. is there any way i could have designed this using joins and simple selects to make it more efficient??
I have a custom code that successfully query my database in SSRS 2005 report. However, I am hard coding its connection string (in the custom code) and I want it to be able to use the same connection string as the ones that the report use. This information is available in my registry setting, but if it is possible, I want to avoid that, since I aim for a quite simple solution. If I am able to get the connection string details at the report level or from within the custom code, it would be great.
Anybody have a suggestion? Anything would be really appreciated.
Hi All,First of all its very very urgent. Secondly I am not an expert. Now here is my problem.I want to loop through my html files and want to save the data in my table column. here is the Code which need correction.CODE:USE [AdventureWorks]DECLARE @cmd varchar(1000);DECLARE @FileName varchar(100);DECLARE @FilePath varchar(100);SET @FileName = 'C: est'+@FilePath+'html';SET @cmd = 'INSERT INTO myTable(FileName, FileType, Document)' + 'SELECT ' + @FilePath + ', FileType, * FROM OPENROWSET(BULK @FileName, SINGLE_CLOB) AS Document'EXEC (@cmd);Select * from myTableJust for practice I am using Adventureworks db. I am using SQL Express 2005.My html files are named something like this:AC0234.htmlDB9803.htmlCG4571.htmlI cannot change my file names.Thanks in advance.Regards;
select * from bigtable where product_code in ('abc','def','hij','klm')
I know that each of those product_codes will return a large data set. What I'd like to do is to run the same query but constrain the result set to a max rownum of 200.
I have some custom code in my report <Code> element that I use to query a database. I have hardcoded the connectionstring in this code but I would like to use the same datasource that the report uses. Is there some report property that allows me to access this datasource?
have a problem ... I tried to test my statement in QA as it returns no dataset ,it gives me empty columns in return,I though it will return all the columns and some records of (lmeyer) as the current user ,who logged in on windows auth,but it return only the columns,is that means my query analyser cannot read the login1 ,column which has the username as (lmeyer)
select * from tstudents where (login1='@param1')
if not what could me wrong in my code ,because I get no response to the sql server
Public Function login(ByVal login1 as string) as dataset
Dim myconnection as new sqlconnection("server=G103-TT03;database=CampusLANDB;Trusted_Connection=yes") dim mycommand as new sqlcommand ("Select * from tStudents Where login1 = @param1",myconnection) mycommand.parameters.add(new SQLClient.SqlParameter("@param1",login1))
dim DS as new dataset()
try myconnection.open
dim adpt as new sqldataadapter adpt.selectcommand = mycommand adpt.fill(DS,"tStudents")
catch ex as exception throw new exception(ex.message) return nothing finally myconnection.close end try
try mydatagrid.datasource=DS.Tables("tStudents") mydatagrid.databind() catch ex as exception errorlabel.text=ex.message end try