So here's what I'm trying to do: I have three columns of data. Sometimes only one of the columns will contain a value while others may contain a null. If two or three contain a value it will be the same. So if I'm building a table in the layout designed and I want the value of the table to be the value stored in these columns. In pseudocode it looks like this:
Switch(column1 and column2 are null, value = column3, if column1 and column3 are null, value = column2, otherwise, value = column1)
Something like that where column1 is the default so if column 1 has a value then set the textbox value to it otherwise find a column that has it. I know that at least one column will definitely have a value. Anyone that can provide guidance on how to execute these I would appreciate it greatly.
I created a Switch statement below that surprisingly doesn't throw any errors and some of it actually works. The problem is that the function calls in the 3rd and 4th sections of it below (in bold) are not working.
=switch(HASONEVALUE('s1JudgeIds'[JudgeName]), values('s1JudgeIds'[JudgeName])<>"1 - All Judges" && values('s1Perm1'[Exit])<>"Still in Out-of-Home Care",CALCULATE(count(s1Perm1[entity_id]),FILTER(ALL(Time[ExitMonthCategory]),Time[ExitMonthCategory] <= MAX(Time[ExitMonthCategory]))), values('s1JudgeIds'[JudgeName])="1 - All Judges" && values('s1Perm1'[Exit])<>"Still in Out-of-Home Care",calculate([Numerator],all('s1JudgeIds'[JudgeName])), values('s1JudgeIds'[JudgeName])="1 - All Judges" && values('s1Perm1'[Exit])="Still in Out-of-Home Care",calculate([Numerator-stillincare],all('s1JudgeIds'[JudgeName])), values('s1JudgeIds'[JudgeName])<>"1 - All Judges" && values('s1Perm1'[Exit])="Still in Out-of-Home Care",calculate([Numerator-stillincare])
Hi All Server 2003 standard edition, MSsql 2005 standard edition As I understand it server 2003 standard only supports 4gb. Does this mean I can only use up to 4gb as the maximum memory for server 2005? If that is the case I would like to use the 3GB switch, and leave the other gig for other apps. If I set the 3GB switch in boot.ini do I then also have to enable AWE (which I can't seem to do) or can I forget about AWE altogether?
Hi,Is it possible to switch to another user's credentials after logging in? Iseem to remember that there is a stored procedure for this, but I can't finddetails anywhere. I want to temporarily suspend my login's admin privilegesand become an "ordinary" user, for testing purposes.Thanks,Peter
There are some concept about context switch block me .
---executor: dbo create user u1 without login
go
create table t
(
col int
)
go
create proc proc1
with execute as 'u1' as
insert into t values(1)
go
exec proc1
I think proc1 can't be run successfully beacuse the executor of proc1 is u1 and I didn't grant any permission to user u1. So it will return a error message like The INSERT permission was denied on the object 't', database 'tempdb', schema 'dbo'
To my surprise, the "exec p1" command could run successfully..
I am trying my first sliding partition scheme with 2005, and I am getting the following error...
ALTER TABLE SWITCH statement failed. Check constraints or partition function of source table "ScanStoreAggregateLoad' allows values that are not allowed by check constraints or partition function on target table "ScanStoreAggregateTest'.
I have gone over the functions and constraints a gazillion times. The columns are set to Not Null. The constraints are set to AND NOT NULL. The constraint values align and align with the function. But still I get the failure. Any help would be greatly appreciated. Here are the definitions:
CREATE PARTITION FUNCTION pfn_ScanStoreAggregate(int)
AS
RANGE LEFT FOR VALUES
(19224,
19225,
19226,
19227)
CREATE TABLE dbo.ScanStoreAggregateTest(
ProductID int NOT NULL,
DateKey int NOT NULL CONSTRAINT ck_ScanStoreAggregateRange CHECK ((DateKey BETWEEN 19224 AND 19227) AND (DateKey IS NOT NULL)),
hi out there On our Windows 2003 servers w. sp1 and running MS SQL Server 2000 w. sp4 we see from time to time that we get this error "cannot allocate 64k continous memory" or "SQL Server could not spawn process_loginread thread" which could be caused by nothing left in the "Memtoleave" pool - I have now search for advice on how to determine the values for the -g-switch - but without much success - and if I just go for the "try&error" concept my sql-server just allocates less and less ??? - ehh - in which units are the parameters for the -g option specified - bytes, kilobytes, mbytes - 4k block ???? Any suggestions for measuring the actual running value of this pool - memtoleave ??
Starting to play around with SQL server at work and this is my question:
In the query design mode in access I can make one of the fields an expression that is driven by a built-in switch function. i.e. Switch([CategoryName] Like "Beverage","Drink",[CategoryName] Like "Cheese","Dairy") This results in the additional column field I created to display "Drink" for each record that has the CategoryName = "Beverage", and "Dairy" for "Cheese".
Can I do something like this in SQL server in the view designer itself, or do I need to make a user defined function and call it?
Any One Tell me how i can use N'Switch in SQL Server Stored Procedure . When I use Such a this syntax i am encountered and stoped with a error. the is below(Stoerd Prdocedure Code) ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- CREATE proc sp_check_userpass(@username nvarchar(50),@password nvarchar(50),@first nvarchar(50),@last nvarchar(50),@email nvarchar(50),@stage int )as declare @cnt int begin select @cnt=count(*) from member_info where (@username=username and @password=password) if(@cnt=0) begin insert into atable(first,last,username,password,stage) values(@first,@last,@username,@password,@stage) end else return @cnt end GO ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- Other thing is that when exec this store proc it must be return a value return back to the @cnt but it is return only This( The command(s) Completed succefully). Any One guide me how i can must be do . i must clear it that i am using this query in ASP.NET SqlClient Object To Execute Query. Thanx In Advance. ArQa
Hello everyone, thanks in advance for reading. I'm new to reports and have tried searching for my answer with no luck. Any direction would be great.
Here is the issue, I have 3 colums in the dataset which display String data ("High", "Medium", or "Low")
I've added a column to the table on the report where I would like to convert the value of "High", "Medium" and "Low" to 3,2,1 respectively then SUM these numbers.
Is this possible? I've tried several variations of the code below--maybe it's not possible to do what I want? Thanks again for your time and help.
Fields!PP.Value is set to: =Switch(Fields!Avail_Rank.Value = "High", 3, Fields!Avail_Rank.Value = "Medium", 2, Fields!Avail_Rank.Value = "Low", 1)
I have two SQL servers. One licensed for 2000 Standard Edition licensed under the processor model. The other is SQL 2000 Enterprise Edition licensed under the user cal model.
I want to switch these Editions and licensing models. My production server needs the Enterprise Edition and I want to put the processor licensing model with it. I want to put the Standard Edition on my reporting server with the user cal licensing model.
I have the instructions to upgraded Editions and it is straight forward. Can I use this procedure for both servers and not have issues?
I need to switch two int values in my table, but I have no clue how to do it. If I switch the 6 to a 5, then I can't distinguish between the 5 that's supposed to be a 5 and the 5 that needs to be a 6. Any help is greatly appreciated - thanks in advance!
Basically I have 635k records in a table with a person's first name, and date of birth (other stuff but it's not relavent). I imported all the data from excel files, but somehow a bunch of records got the first name and date of birth mixed up, so I'm trying to write a stored procedure that would switch the first name with the date of birth wherever the firstname is purely numeric, or something of the sort. Now records are in fact repeated so another possible but more time taking solution is to write a stored procedure that I give the date of birth and it does the switching around for the respective date of birth when it's found inside the First name. Any suggestions? All the code I've written has proved useless :/
Is it possible to switch back to SQL 6.5 after upgrading to SQL 7.0 using the tape method? During the tape upgrade the 6.x devices are deleted. Is there no backout plan?
Dear all,i am planing to implement a Windows 2003 Cluster with MS SQl 2000Enterprise Edition. I have 2 Nodes (4 * XEON MP Processors) with 8 GBRAM per Node.I have the need for 6 SQL instances and would like to implement aactive-active cluster. What do you think it the best way to configurethe memory for the Servers ?I would like to run 3 instanced per Node but can i allocate 7 GB perNode for SQL (and 1 for the Operating System) ?What is happening then i one server fails ?Should i plan to allocate only 3 GB per Server for SQL to make surethat one server can handle the load for all instances if one serverfails ?Should i use the /AWE switch only in the boot.ini to allow more than 4GB Memory ?or should i use the /3 GB switch as well ?Maybe somebody can give me a hint.Best regards,Walter
Hello,I encounter a problem with a small portion of sqlcode. I try to go ondatabase using "use dbname" but i always stay in master. I executescript with the sa user.declare @dbnamesysnamedeclare @ret_codeintDECLARE db_cursor CURSOR FORselectnamefrommaster..sysdatabaseswherename not in ('master', 'model', 'tempdb', 'pubs', 'Northwind')-- Open cursorOPEN db_cursorFETCH NEXT FROM db_cursor INTO @dbnameWHILE @@FETCH_STATUS = 0BEGINexecute ('use ' + @dbname)execute ('select db_name()')Thank's for help,Pierrot.
We are running a DTS package with the dtsrun utility and would like topass a variable through it. Inside our package we have a VB scriptthat references a table that contains the information about all of ourjobs and we would like to pass a variable to tell it which jobs torun. The reason we cannot just add the variable to the VB script,i.e. in a where clause, is because we would like more then 1 bat fileto run this package. We want some jobs to run with 1 bat file andother jobs to run with another. If we could pass through a variableof 1 that would refer to a column within our table then only thosejobs would run at that time. Make sense?Any help is appreciatedThanks
I have a couple of reports with predefined queries. When I try to edit a data set query it goes directly to query design mode losing the query I already had. As you can see this is a real problem because I can't edit queries. How can I switch off design mode? any ideas are pretty much appreciated.
Does anyone know how to get the original Login name, while a context switch is in effect.. For example during the use of Original login to SQL is Wayne Then Execute as Test
Now I need to know that Wayne is the Login and not Test
none of the standard things work, they all use the current context (suser_sname, etc)... Books online includes the following text
SYSTEM_USER returns the name of the currently executing context. If the EXECUTE AS statement has been used to switch context, SYSTEM_USER will return the name of the impersonated context. Use the LOGIN() function to return the name of the original login during impersonation.
But I cannot find any function called LOGIN() anywhere?
I added an activeX package and then try to execute it, when I run it comes up with following error:-
Error 1 Validation error. DTSTask_DTSDataPumpTask_1: OLE DB Destination [181]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The Acquire Connection method call to the connection manager "Microsoft OLE DB Provider for SQL Server Copy" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the Acquire Connection method call failed. SearsCDCC_Transfer.dtsx 0 0
I did some research on line and I came to know that I need to switch the debugging mode to change the 64 bit to false. But I am too novice in SSIS, so I am not sure how to switch the debugging mode. Any idea about it?
I have switched my datatype to varChar(7000). I set to "only" 7000 to allow for the addition of other fields and still stay under a 8000byte record limit. My data is still being truncated sometimes. I''m not even able to get up near 7000 characters on the big text field.
I have a table partitioned by month. There are no primary key. There is another table with the same structure that I use to load data for the current month. I can perform partition switch with no problem.
I created non unique index on integer field in both tables. After this change partition switch does not work anymore. Here is an error that I am getting:
'ALTER TABLE SWITCH' statement failed. The table 'dbo.test' is partitioned while index 'IX_test' is not partitioned."
hi out there On our Windows 2003 servers w. sp1 and running MS SQL Server 2000 w. sp4 we see from time to time that we get this error "cannot allocate 64k continous memory" or "SQL Server could not spawn process_loginread thread" which could be caused by nothing left in the "Memtoleave" pool - I have now search for advice on how to determine the values for the -g-switch - but without much success - and if I just go for the "try&error" concept my sql-server just allocates less and less ??? - ehh - in which units are the parameters for the -g option specified - bytes, kilobytes, mbytes - 4k block ???? Any suggestions for measuring the actual running value of this pool - memtoleave ??
I am having problem when performing the alter table switch. Both tables are identical and have pk.
ALTER TABLE SWITCH statement failed. There is no identical index in source table 'LocalDeltanet.dbo.testresults' for the index 'PKIDX_testSummary' in target table 'LocalDeltanet.dbo.testresults_part' .
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON TResultsScheme (testresult_id) ) ON TResultsScheme (testresult_id)
I have performed the function on other tables successfully, but this is the first that has an identity column involved. Is there anything special that needs to be done?