|
Looks like your answer gives me the answer I need.
CASE WHEN Role = 1 Then 1 else 0 end IsAdministrator,
CASE WHEN Role = 2 Then 1 else 0 end IsDecisionMaker,
etc.
Thanks,
Michael
|
|
|
|
|
Dimitry --
I now have to add one additional field but this one is harder. Each contact has an AccessGranted table tied to them with the locations they can access. I need to reduce that table down to a boolean CanAccess. How do I do something like that when I don't really have a customer key to work with. This is what my view looks like right now:
SELECT TOP (100) PERCENT dbo.CustomerMaster.BSACustomerKey, dbo.ContactMaster.ContactName, dbo.ContactMaster.BusinessPhone, dbo.ContactMaster.MobilePhone,
dbo.ContactMaster.Email, dbo.ContactMaster.FirstName, dbo.ContactMaster.LastName, dbo.ContactMaster.EmergencyMaintenance,
dbo.ContactMaster.NormalMaintenance, dbo.ContactMaster.NetworkAbuse, dbo.ContactMaster.IssuedSwipeCard, dbo.ContactMaster.CardNumber,
dbo.AddressList.CustomerAddressLine1, dbo.AddressList.CustomerAddressLine2, dbo.AddressList.CustomerAddressLine3, dbo.AddressList.CustomerPostBox,
dbo.CityEnumerator.City, dbo.StateEnumerator.State, dbo.AddressList.CustomerCounty, dbo.AddressList.CustomerCountry, dbo.AddressList.CustomerZipcode,
dbo.ContactMaster.BmcCustKey, CASE WHEN dbo.ContactMaster.Role = 1 THEN 1 ELSE 0 END AS IsAdministrator,
CASE WHEN dbo.ContactMaster.Role = 6 THEN 1 ELSE 0 END AS IsDecisionMaker,
CASE WHEN dbo.ContactMaster.Role = 5 THEN 1 ELSE 0 END AS IsAccountingAP
FROM dbo.ContactMaster INNER JOIN
dbo.CustomerMaster ON dbo.ContactMaster.CompanyID = dbo.CustomerMaster.CustomerIdentity LEFT OUTER JOIN
dbo.AddressList ON dbo.ContactMaster.ContactAddress = dbo.AddressList.AddressIdentity LEFT OUTER JOIN
dbo.CityEnumerator ON dbo.AddressList.CustomerCity = dbo.CityEnumerator.CityIdentity LEFT OUTER JOIN
dbo.StateEnumerator ON dbo.AddressList.CustomerStateorProvince = dbo.StateEnumerator.StateIdentity
WHERE (dbo.CustomerMaster.CustomerStatus = 1) AND (dbo.ContactMaster.Status = 1)
ORDER BY dbo.CustomerMaster.BSACustomerKey
|
|
|
|
|
I'm on a WORKGROUP LAN at home, and I want to connect to an instance of SQL Server 2005 Express on one of the other boxes on the network. I have already enabled remote connections on that instance of SQL Server and restarted the service.
When I try to connect, it tells me this:
TITLE: Connect to Server<br />
------------------------------<br />
Cannot connect to HTPC.<br />
------------------------------<br />
ADDITIONAL INFORMATION:<br />
<br />
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)<br />
<br />
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Saturday, March 27, 2010 11:52 AM
|
|
|
|
|
Have you also enabled Named Pipes through the Configuration Manager?
|
|
|
|
|
Yeah.
Could it be a user account problem?
When I try to connect (using Windows Auth), it uses my local box's user account.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Have you got Mixed Authentication set in the Sql Server Express instance? If so, can you connect using non-windows authentication?
I noticed that the message said that it can't find instance HTPC; Is that the name of the instance or is it HTPC\SQLEXPRESS?
|
|
|
|
|
i.j.russell wrote: Have you got Mixed Authentication set in the Sql Server Express instance? If so, can you connect using non-windows authentication?
No, but do I want to use non-windows authentication?
i.j.russell wrote: I noticed that the message said that it can't find instance HTPC; Is that the name of the instance or is it HTPC\SQLEXPRESS?
HTPC is the machine name. The server is HTPC\SQLEXPRESS.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
The reason for asking about mixed mode authentication is that if you can connect using a connectionstring like this;
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;
but not like this;
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
then you do have a permissions issue. However, most connection problems are due to incorrectly naming the server or database. The more things we can discount, the easier it will be to fix.
|
|
|
|
|
This is almost a non-issue, as I have halfway decided to use SqlLite instead. Thanks anyway.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Could someone help me with this one perhaps?
Let's say I have a simple SQL query like:
SELECT EmployeeID, EmployeeName, YearStarted FROM Employees
I'd like to return a fourth column in the result set of which the value is conditional upon the value of another column. For instance, if the value of YearStarted is older than 2007, return 'veteran' otherwise return 'spring chicken'.
I'm thining something like:
SELECT EmployeeID, EmployeeName, YearStarted, IF(YearStarted<2007,'Veteran','Spring Chicken') FROM Employees
but obviously such an IF statement doesn't exist in SQL. Is there another way to do it?
|
|
|
|
|
select
EmployeeID,
EmployeeName,
YearStarted,
case
when YearStarted < 2007 then 'Veteran'
else 'Spring Chicken'
end NewColumn
from
Employees
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
|
|
Wouldn't only string functions work? Just guessing.
|
|
|
|
|
Hi!
I was wondering what edition of SQL server i can install in win 7 ultimate!
Thanx.
|
|
|
|
|
I use SQL Server 2008, if that helps.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
yeah i forgot to say sql 2008!
but what i meant was which edition? standard? enterprise? ....?
|
|
|
|
|
The OS has very little relevance of the edition you should use, it depends on your database requirements, This may help http://www.microsoft.com/sqlserver/2008/en/us/editions.aspx[^]
If you are asking about a development environment then use either developer or express versions.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
For many years I have been using vb6 with Access Database as back end. In many cases while returning record sets Access is omitting the very first record and it returns the rest of the records. I am really baffled. Please help.
Hi all of you, I have corrected my mistake and got the answer for this question.
Here is how I got it solved. The records were stored with time field. When querying up I did not mention the begining of the starting day (like 00:01 - which implies the start time of the day) and the end of the day in the finishing date. (Thought up this solution very late.) And so I was getting a few records eliminated from the query result set.
Thanks for all of you who tried to help and you can consider my question closed.
Hope this helps somebody.
-- modified 1-Apr-16 12:47pm.
|
|
|
|
|
Are you confusing zero-based and one-based indexing for arrays?
Otherwise, showing some code might help us help you.
|
|
|
|
|
Whatever it returns first is the first. Or maybe you're using it wrong.
|
|
|
|
|
Dear,
Can anyone help me to make good database structure?
What i have are some locations where I have some machines. Every machines have 2 counters (IN and OUT). I need to be able to enter state of that counters and after that to compare that values with previous entry IN and OUT counters.
How I see it seams that somewere I need to keep information wich machine is on wich location. Beside that I need to track information about date and time of entries.
Situation:
Location 1 -> machine1, machine2, machine3
Location 2 -> machine4
Location 3 -> machine5, machine6, machine7, machine8
....
I need 3 kind of reports:
○ Deference between new IN / OUT and some old IN/OUT counters for every machine
○ Total IN/OUT for some location
○ Total IN/OUT for all location
How I need to organize this datas?
Thanks for helping me,
akioki
|
|
|
|
|
3 tables
Location
LocationID int identity(1,1)
Location varchar(20)
Machine
MachineID int identity (1,1)
LocationID int
Machine varchar(20)
TranTable
TranID identity (1,1)
MachineID
Direction
Date
This assumes a machine can have only 1 location and the machine can be checked in/out many times. Using a date on the transaction table will allow you to get durations, and state on a given date
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All,
I am using SQL Server 2005. My problem is that I am unable to start MSSQL Server. When I go to services.msc, i found that the state of MSSQLServer is stopped. When I click on start, it gives me this error:
The SQL Server (MSSQLSERVER) service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts Service.
I try all possible things, google it and atlast re-install SQL Server but nothing happen. So please help me??
Thanks
|
|
|
|
|
Have you checked the event log to see if there are any messages relating to this in there?
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|