Transact SQL :: Accurate Count Of Workstations Connected To Database?

Nov 2, 2015

How do I get an accurate count of workstations connected to a database?

View 7 Replies


ADVERTISEMENT

Keeping An Accurate Count Of Events

May 16, 2006

I am newish to databases and would appreciate some
advise.  I think I have a solution to my
problem but it is going to take me a lot of time to get it running.  If there is a better way of doing it I would
like to know. 

I have a table :-





 â€œeventDatesâ€? with
columns (id, date, eventID,
eventCount)







The id auto increments as a Primary Key.
date holds the date of the
event.
EventID references another
table with info about the events
Up to 9 eventIDs can be added
for each date and I want eventCount to hold an integer (1 to 9) to allow me to “pivot�
the data to the table below




“results� with columns (date,
eventCount1, eventCount2 …..eventCount9) so each row will hold a date and non
to nine eventIDs occurring on that date.





Is there an easy way to keep eventCount accurate or do I
just have to write a lot of code?  I
will need to be able to remove events as well as add them.  I will use a mixture of stored procedures
and VB.Net I guess?





Many thanks for any advice.





Mike

View 4 Replies View Related

Change ODBC Pointer On Workstations After Database Move

Jul 23, 2005

I am by no means a "Database Expert" and have recently been asked toassist with a SQL 2000 database move to a new server. I was wonderingif there was an easy way to reconfigure the ODBC pointers on theworkstations?Thanks for the help in advance.

View 1 Replies View Related

Can Multiple Workstations Running SQL 2005 Server Express Attach To The Same Database Files On A Shared Network Location?

Mar 15, 2007

Can multiple instances of SQL 2005 Express attach to the same database files on a network share? I have seen this done before with MSDE where the database files are stored on the server, but instead of having a SQL server running on the network and then connecting to it, only the database files exist on the network share and the users connect through MSDE running on the local machine. Is this possible with SQL2005Express? I do not have the ability to share an SQL instance from one workstation to another nor do I have the ability to install an instance on the corporate server. Is it as simple as creating the database and storing the files on the share then attaching the database to the SQL Instance on each workstation?

View 3 Replies View Related

Database Cannot Be Connected??

May 19, 2008

Dim delconn As New SqlConnection _
("data source=15-46SQLEXPRESS;AttachDbFilename =C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataProjectDB.mdf; Integrated Security=True;")
 
this is my coding,
anyone can spot an error from there??
the database can't be located somehow....
 help me ,for god sake
 

View 1 Replies View Related

Why Isn't The SQL Database Being Connected?

Jun 9, 2006

if not Page.IsPostBack then            Dim strConn As String = "server=(local);database=NORTHWND"    Dim sql as string = "Select EmployeeID, FirstName, LastName from Employees"    Dim conn as New SQLConnection(strConn)            Dim Cmd As New SqlCommand(sql, conn)            Dim objDR As SqlDataReader            conn.Open()'This is where it has an error and says-- An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. The NORTHWND database is set up in the web.config fileThanks! Jon

View 3 Replies View Related

Connected To Which Database

Jul 20, 2005

Hello all,I have a scripts which needs the information about the database inwhich it is running.How can I find out this information.For example if I want to know the User who has satrted this report, Iuse the SYSTEM_USER procedure.Does an equal procedure exist to find out, on which database the useris connected to.RegradsFranz-Josef

View 1 Replies View Related

Last Time Someone Connected To A Database

Aug 11, 2005

Hello all,Is there a way to figure out when was the last time someone connected toa database? SQL 2000 environment.Thanks,Raziq.*** Sent via Developersdex http://www.developersdex.com ***

View 5 Replies View Related

64-bit Server Deployment From 32-bit Workstations

Apr 28, 2006

Our workstations (XP SP2) and development servers (2003 R2) are all
32-bit. Our Staging and Production SQL
Servers are 64-bit (2003 R2 x64). We
have some VB SQLCLR assemblies we've developed.

My question is: Do we have to do anything special when deploying a CLR
Assembly to a 64-bit box when it has been compiled on a 32-bit box? Are there any advantages to setting the
Target CPU from "AnyCPU" to "x64"? Documentation and testing seems to indicate that the
assembly will run in 64-bit mode if compiled to "AnyCPU".

Will it run "better" in 64-bit mode
with the "x64" Target CPU type?

Thanks!

View 3 Replies View Related

List All Users Connected To Database

Dec 14, 2007

Hi,

I need to be able to list all User connected to a particular database, after doing a bit of playing I have writen a simple view in the database to show this information which looks like

select spid, status, loginame, hostname, blocked, db_name(dbid), cmd from master..sysprocesses where db_name(dbid) = 'AutoCost2008

But my problem is that as this needs to be run from an application where the user is logged on as a standard user and therefore when this is run it only shows the current user, I am not sure what permissions I need to give this login to allow them to view all users connected to this database without giving them full Admin permissions, can anyone please help.


Thanks,


Gavin,

View 3 Replies View Related

Open Database In A Connected Device

Jan 19, 2007

Hi Everybody:

I'm writting an standar application in c# that comunnicates with a sql server 2005 in a mobile device. The mobile device is connected to the pc with an usb wire. In the sample I've made, I've inserted in the form main a datagridview. I go on the wizard to select the data source. I choose a Microsoft SQL Server Mobile Edition data connection. The data source is tge activesync mobile device. I create a new database in the mobile device called test.sdf. The wizard has a button to check the conecttion and it rules. A new connection appears in the server explorer. I add rows through a query. I build the solution and no problem, but when I start the debug session an sqlceexception occurs: Data Source not found. In the database connection that the project has created the connection string is: Data Source ="Mobile Device est.sdf";

I didn't write any code. I just went on the wizards. All the code has been inserted by visual studio 2005.

Any idea?

View 3 Replies View Related

How Can I See To Which Database And Table The Web Service Is Connected To?

Dec 4, 2007

Hello All!

I have one web service, which Im testing.
I would like to connect it (the web service) to a a database with the same structure as the old database I was using before.

Only difference is the name of the database and that the web service was done in visual studio 2003.
I have now VS 2005.

Can this be done through Microsoft SQLServer management studio express?

Or how can I see to which database and table the web service is connected to?


Thanks in forehand!

Nikita

View 1 Replies View Related

Publish C# Project Connected To Database?

Aug 10, 2015

i want ti publish a c# project connected to sql database, i introduced the database into my project, i use the connection string: 

  SqlConnection cn = new SqlConnection(@"Data Source=CONTA-LAPTOP;Initial Catalog=RaducuIonel;Integrated
Security=True");  if right click on the database-> properties iti show me next connection string: Data Source=CONTA-LAPTOP;AttachDbFilename="C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATARaducuIonel.mdf";Initial
Catalog=RaducuIonel;Integrated Security=True    

...when i connect to server in sql i use windows autentification. And the last thing: when i publish the project it ask me: application will check for updates from [URL] or application will not check for updates. I select first option: to check for updates from here: [URL] .to another computer my application cannot connect to database (login error) .what i am doing wrong? 

View 2 Replies View Related

SQL Server 2008 :: How To Find Who Is Connected To A Database From DMV

Sep 16, 2015

I have a query that finds all SPID's connected to a particular database:

select d.name, p.*
from sys.databases d join sys.sysprocesses p
on d.database_id = p.dbid
where d.name = 'my_db'

But now we have a new rule that we should not use outdated compatibility views, and one of them is sys.sysprocesses. I checked sys.dm_exec_connections/session/requests but failed to replace my existing code. The first two don't have dbid, the last one, requests, has it, but it selects only currently executing statements.

View 0 Replies View Related

SQL Server 2008 :: How To Find Who Is Indirectly Connected To A Database

Feb 25, 2015

Recently I needed to find all processes connected to a particular database, let's call it Test_db. I have a simple query to find all connections to my database:

select *
from sys.databases d join sys.sysprocesses p
on d.database_id = p.dbid
where d.name = 'test_db'

But there was a process that was connected to another database like USE another_db_name; but was actually selecting from tables in test_db. Is it possible to catch such connections?

View 7 Replies View Related

Select Data From Table In One Database Server While Connected To Another Database Server.

Dec 18, 2007



Hi,


Is there a way in SQL Server 2005 to use a select statement to fetch data from a table in another Server while running the query in one Server.

Like using a database Server Link in oracle...


Thanks
Pramod

View 8 Replies View Related

How Accurate Is GetDate() ?

Sep 26, 2006

According to MS, GetLocalTime() (in C++) is only accurate to approx asecond,even though it reports milliseconds, and calling it twice and computingtheinterval can on occasion lead to a negative interval.Is T-SQL's GetDate() more accurate than that, or at leastnon-decreasing?Thanks,Jim

View 4 Replies View Related

Error_line() Not Accurate?

Mar 20, 2006

Hello,

I'm just trying out this new try-catch stuff in sql server 2005....

Using the example from the help, "Using TRY... CATCH in Transact-SQL" , it shows how things are done in the adventure works database.. loggin the error to the errorlog table and all that... looks great.. but I notice that when I implement this code in my project.. and tested by putting in a line that causes a divide by zero error... that the line number reported by error_line is acutally not the line at which the divide by zero code resides....



Any suggestions as to what would put the error_line out of whack? I have comments and some string literals in the code..would they be throwing it?



Thanks

View 5 Replies View Related

Accurate Divisions?

Apr 24, 2006

Hi, how can i get a accurate division in tsql - is there some way of casting?

Problem is simple, "SELECT 3 / 2" is "1" - what can i do to get 1.5 as result?

View 3 Replies View Related

Transact SQL :: When To Use Count And Sum

Jun 20, 2013

How do you know when you should use COUNT and when to use SUM functions?

View 12 Replies View Related

Transact SQL :: Want To Get A SUM Of COUNT

Jun 29, 2015

I have the following query and want the results within my query although I want to be able to get the SUM of my COUNT results. So basically I want the SUM of [Document Count] within my query/

DECLARE @Date date;
SET @date = '02/05/2015'
SELECT CONVERT(VARCHAR,CONVERT(Date, @Date, 103),101) AS [Date Scanned], (SELECT COUNT(*) FROM QUEUE WHERE date_scanned = @Date) AS [Total Scanned],
COUNT(dbc_state) AS [Document Count],
CASE
WHEN dbc_state = 1 AND ON_HOLD = '1' THEN 'On Hold'

[code]....

View 3 Replies View Related

No Error But Results Not Accurate?

Aug 21, 2012

SELECT
ts.[EmployeeId]
,p.[FirstName]
,p.[LastName]

[Code].....

This query should show people that have worked under 4 days but it displays the full database including all the people with 4 or more entries.

It works if the [StartedAt] and [HoursWorked] Fields are not included but I need these fields included.

View 2 Replies View Related

Transact SQL :: Count As Per Column Value

Jul 2, 2015

I have table like below

col1 volume
A 22
B 28
C 1
E 3
D 4

Output should be like below

col1 vol
A 22
B 28
Others 8

View 4 Replies View Related

Transact SQL :: Way To Count Changes In Value Of A Field

Oct 13, 2015

I want to avoid iterating through a table row by row and programmatically incrementing a counter,/I have define a view called Q2 with the following fields of interest:

Trial varchar(25)
BI int
Track int
CAT int

What I would like to do is partition by Trial, BI, and Track, and count the number of times CAT changes value. In Access, I would just iterate through a recordset inside a function, but I would like to see if there is a set based solution.Adding Sample Data and Output.

Trial     BI     Track     CAT
A         5      3           1
B         5      3           2

[code]...

View 5 Replies View Related

Restore From Log Backup: Time Is Not Accurate

Jun 17, 1999

I do hourly transaction log backups at 9,10, 11 etc...
When I restore from a 9:00 backup I clearly see changes that I made after 9:00 am!!!
I then noticed when I go to my scheduled backups that a 10 am backup was indeed done
but in the "restore from device" tab it says the last backup was at 9 am.
Apparently it is not showing the actual latest backup that was done. This explains why
when restoring from a 9am backup I am seeing changes after 9, because in reality
I am restoring from a 10 am backup!

Is this a bug? I am running on 6.5 sp 5a.

thanks in advance....Mary

View 1 Replies View Related

Containstable Not Returning Accurate Results

Aug 27, 2007



Does anyone lese get the same results that I do?

tblTest has an id field and a testName field....table has 2 records:
1 kevin test 1
2 kevin test 3


SELECT *

FROM tblTest t

INNER JOIN CONTAINSTABLE(tblTest,*,'"kevin test 1"') as A ON t.id = A.[KEY]

Result is both records returned, but since the search is in quotes as an exact phrase, should not just the first record be returned?

View 3 Replies View Related

Transact SQL :: COUNT And SUM Of Multiple Columns

Sep 2, 2015

I'm working on a data analysis involving a table with a large number of records (close to 2 million). I'm using only three of the columns in the table and basically am grouping results based on different criteria. The three columns are PWSID, Installation and AccountType. I have to Provide the PWSID column with a count of the total number of installations per PWSID, also a count of AccountTypes per PWSID. I have the following query, but the numbers aren't adding up and I'm not sure why. I'm falling short in the total count by around 60k records.

CREATE TABLE [dbo].[CATASTRO_PSWID_SHPMUNINEW](
[Installation] [numeric](38, 8) NULL,
[AccountType] [nvarchar](50) NULL,
[PWSID] [smallint] NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

[code]....

View 8 Replies View Related

Transact SQL :: Query To Retrieve Max Count

May 28, 2015

The below is my query in SQL SERVER 2012

DECLARE
@PN_INC INT,
@POSITION_DESC VARCHAR(15)
SELECT @PN_INC= MAX(PositionNumberInc) FROM dbo.tblPosition WHERE LTRIM(RTRIM(UPPER(PositionDescription)))=LTRIM(RTRIM(UPPER(@POSITION_DESC)));
SELECT @PN_INC is returning null when there is no record in the table;

1. how can I make it return 0 when @PN_INC is null else it should pick the MAX(PositionNumberInc) value

2. I have written the below query to return 0 when @PN_INC is null  but I need query to select the MAX(PositionNumberInc) value when @PN_INC is not null 

SELECT @PN_INC= coalesce(MAX(PositionNumberInc), 0) FROM dbo.tblPosition WHERE LTRIM(RTRIM(UPPER(PositionDescription)))=LTRIM(RTRIM(UPPER(@POSITION_DESC)));

View 6 Replies View Related

Transact SQL :: Count Only Latest Entry

May 25, 2015

I have a table with below structure, with a sample entry for 1 country:

ID Date              Event CountryCode TxnID
1   22/05/2015   ABC   123   111
2   23/05/2015   XYZ   123   111
3   20/05/2015   XYZ   123   222
4   21/05/2015   ABC   123   222

So, I need to get a count like:

FOR COUNTRYCODE=123
ABC count= 1 
XYZ count= 1

Which means, I want to count for each transaction, the latest entry based on date. And there can be many countries like this. And I need to count both entries for ABC & XYZ.Normal count will give me duplicate entries.

View 10 Replies View Related

Transact SQL :: Display 0 With COUNT And GROUP BY

Aug 25, 2015

How can I display 0 when using COUNT and GROUP BY?I'm using SELECT CASE in my query. I was trying to use COALESCE but no result, COUNT result = 1. (there should be 0).

COALESCE((COUNT(DISTINCT (CAST((CASE
WHEN CurrStat = @Stat AND LogDate = @LogDate THEN Enumber ELSE 0 END) AS int)))), 0) AS InTrack,

View 5 Replies View Related

Transact SQL :: How To Get Count From A Large Table

Jun 1, 2015

I have a table with a couple hundred billion records (sql server 2005). When I do a select count(*) from tblx -- it takes this side of forever. Is it possible to count partitions and then add them up to make it faster?  

How I could improve the performance for count(*) of this huge table.  Note:  if the partition idea sounds viable -- what would that look like? 

View 11 Replies View Related

Transact SQL :: Count Weeks With More Than Two Records

Aug 22, 2015

My table is test and I have an ID and DateTest columns

I would like to count the weeks with more then one record.

So far I got this and return the weeks with 1 record per week. How can I count the weeks with more then one record

select sum(c)
from (
select c = count( id) over (partition by id, datepart(week, DateTest))
from test where id = '1' and DateTest >= '7-7-2015'
) a where c = 1

View 11 Replies View Related

Transact SQL :: How To Write A Cursor For Row Count

May 20, 2015

I have a table which table has :Identity Column (Identity), Schema name and Table_Name.

So I would like to write a cursor For each Table Count(*) from Table--@Cnt Int , Schemaname and Tablename need to store another table.

 Implement a USP, using a cursor that scan the  table, generate select count statement from configuration table  and fire the select count statement and record the result of the query in the log table :

how can I write a cursor and Import Those results into to Another table.

View 3 Replies View Related







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