Invisible String? I Turn To You, The Reliable ASP.NET Forum Experts, For A Last Ditch Try. Please Help Me Out.

Mar 14, 2008

I have been tring to get this one line figured out for a few days now. 

'Job2 Info

Dim selectSQL2 As StringselectSQL2 = "SELECT * FROM '" & CompanyKey & "'"                    '<<-------HERE

Dim cmd2 As New SqlCommand(selectSQL2, con)

'Job2 Select

Try

con.Open()

reader = cmd2.ExecuteReader()

 

(I have the full code below.)  So here is the problem, this code is not populating the datagrid.  There is data in the table I am selecting from.  When I log in, my CompanyKey value displays in the label as "21".  When I take out the "CompanyKey" variable, and just type in 21, the grid is populated. It is confusing the heck out of me.  I have tried it this way:

selectSQL2 = "SELECT * FROM [" & CompanyKey & "]"

-and this way:

selectSQL2 = "SELECT * FROM & CompanyKey

and all the other ways I could think of.  I researched it and can just not get it to work any way I do it.  Any suggestions?  Full code below:

____________________________________

 

 

Imports System.DataImports System.Data.CommonImports System.Data.SqlClient

 

 Partial Class _Default

Inherits System.Web.UI.PageProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'Database ConnectionDim con As New SqlConnection("Data Source = .SQLExpress;integrated security=true;attachdbfilename=|DataDirectory|ASPNETDB.mdf;user instance=true")

'Job1(Info)Dim currentUserID

currentUserID = Context.User.Identity.Name.ToString()

Label1.Text = currentUserID

Dim selectSQL1 As StringselectSQL1 = "SELECT companyKey FROM Company WHERE UserID = ('" + currentUserID + "')"

Dim cmd1 As New SqlCommand(selectSQL1, con) Dim reader As SqlDataReader

Dim CompanyKey

'Job1 Select

Try

con.Open()

reader = cmd1.ExecuteReader()Do While reader.Read()

CompanyKey = reader("CompanyKey").ToString()

Loop

reader.Close()Catch err As Exception

ReaderError.Text = "Error selecting record."

ReaderError.Text &= err.Message

Finally

con.Close()

End Try

'Job2 Info

Dim selectSQL2 As StringselectSQL2 = "SELECT * FROM [" & CompanyKey & "]"

Dim cmd2 As New SqlCommand(selectSQL2, con)

'Job2 Select

Try

con.Open()

reader = cmd2.ExecuteReader()

GridView1.DataSource = reader

GridView1.DataBind()

reader.Close()Catch err As Exception

ReaderError.Text = "Error selecting record."

ReaderError.Text &= err.Message

Finally

ReaderResults.Text = CompanyKey

con.Close()End TryEnd Sub

 

End Class

View 4 Replies


ADVERTISEMENT

Turn Hex Into Char String And Concatenate

Feb 16, 2006

I've been trying to return hex data in a way that can be concatenated.
I need the actual hex info (e.g. 0x6E3C070) as displayed
since it contains info about the path to a file.
So I can turn it into D:6E3C7 to get the path to the file.
In searching around I have come across a way to do this but can't figure out how to get it to run through a column and either display or insert into a table multiple results.

-Here's the user function that converts an integer into a hex string-

CREATE FUNCTION udf_hex_string (@i int)
RETURNS varchar(30) AS
BEGIN
DECLARE @vb varbinary(8)
SET @vb = CONVERT(varbinary(8),@i)
DECLARE @hx varchar(30)
EXEC master..xp_varbintohexstr @vb, @hx OUT
RETURN @hx
END
GO


-Using this table-

create table
XPages
(PageStoreId int null,
HexString varchar (30) null,
VolumePath varchar (60) null, )


--'PageStoreId' contains the data that needs to be converted into the editable hex string
--'HexString' is where I'd like it to go so I can parse it later.

--I can run the below select and get the hex string. But am stuck on how to run a select or update that would run through the 'XPages.PagestoreId'
column and insert the hex string into the 'XPages.Hexstring' column. 'XPages.PagestoreId' could have 100's of entries that need to be converted and placed in the relevant the 'XPages.Hexstring' column.


SELECT dbo.udf_hex_string(1234)



Thanks

View 3 Replies View Related

Is @@IDENTITY Reliable?

Jul 20, 2005

SQL 7.0I have a form in ASP.NET and I want to write the values to the SQLServer tables.The tables are Customer and Address tables.There will be an insert into the Customer table, and I need to use theIdentity of this inserted record for the Foreign Key in the Addresstable insert.For exampleINSERT INTO Customer (CustomerName)VALUES (@CustomerName)Select @@identity as CustomerIDINSERT INTO Address (Address, CustomerID)VALUES (@Address, CustomerID)My question is this. If I put this into a single stored procedure canI absolutely GUARANTEE that the @@identity value will be from theCustomer table insert, or could it feasibly be from another, as itwere, colliding operation?TIAEdward--The reading group's reading group:http://www.bookgroup.org.uk

View 2 Replies View Related

How Reliable SQL Compact 3.5 Is?

Jan 16, 2008

How reliable the SQL Compact 3.5 is?

What I need is to make sure that in case if my Windows CE based device lost power supply my SQL Compact 3.5 database will not be corrupted and I can read data from it.
Has anybody any experience in this area?

This is critical requirement for our project and I want to know it is feasible or not.

View 1 Replies View Related

Reliable Connection With SQL Server

Mar 5, 2007

Hi..

I have a SQL Server 2005 Database .. I develop for the customers a C# Application , that sends some specific Information to my central Database.

If I would create a connection over tcp/IP (in order to send data to central database) like

sqlconnection1.ConnectionString = "Data Source=192.XXX.Y.ZZ,1433;Initial Catalog=Muster;Integrated Security=True";

it would not be reliable. How can we make that safe?

Thanks...

View 4 Replies View Related

Need A Reliable Backup Plan Fro SQL 2000

Nov 22, 2002

I have set up two Maintenance Plans to do daily backups overnight for our two DBs that are on our SQL server.

As a separate strategy we want to have a second backup done nightly that would involve
#1 detach the db(s)
#2 copy the mdf(s) and ldf(s) to L:xxx
#3 attach the db(s) again
#4 zip up the db(s)
#5 copy the files to a different server for storage.

I created #1, and #3 in query analyzer and saved the script.

I want the process to run at say 2AM and don't know how to schedule them to run - that is #1 ... #2 ... #3. Anyone have sample scripts for this kind of a backup strategy?

This seems like a very simple process especially for a restore and especially since there would not be any trasaction logs involved. This way if we had a KRASH we could take the backup from the separate server and install it on a warm SQL backup server.

Apart from the new servers name then what other steps would I need to cover to get the apps up and running in the quickest time. The app software runs as a client install - Access 97DB] I'm especially curious if I need to have more than a fresh MS2000 SQL server install.

I'm know I'm asking a lot for a first timer.
It seems we want to handle disaster recovery BEFORE we even have our first system crash.

many thanks

View 11 Replies View Related

Getting Reliable Information About Cache Hit Ratio

May 5, 2004

Maybe I am just a lot better at this than I thought, but I figure that somewhere there is a mathematical rule that is being overlooked. When I run dbcc sqlperf (lrustats) on some of my production machines, I sometimes end up with a cache hit ratio (which is defined as a percentage, mind you) that is slightly over the limit:

Statistic Value
-------------------------------- ------------------------
Cache Hit Ratio 100.00898
Cache Flushes 0.0
Free Page Scan (Avg) 0.0
Free Page Scan (Max) 0.0
Min Free Buffers 331.0
Cache Size 4362.0
Free Buffers 9434.0


I suspect some counter somewhere is getting wrapped around its 4 byte limit. Is there any reliable source for getting statisics about SQL Server performance? Users tend be unreliable and say everything is slow.

View 2 Replies View Related

Reliable Method Of Restoring Over Existing Database

Dec 29, 2007



I have a process that restores a backup from a primary server to a backup server daily. When doing the restore, sometime it fails (for various reasons).

I have coded a job to Set offline, set online, an then do the restore:

RESTORE DATABASE [xxx] FROM DISK = N'D:Backup Stagingxxx.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10

Sometimes it fails to bring back online, other errors as well. Is there a reliable method of doing this?

View 1 Replies View Related

Reliable, Fast Method Of Exporting Data To Sql

Jul 5, 2007

Hi,



For this scenario, what is the best method of exporting data to sql 2005.



I want to export data from desktop app across internet to sql which can do on a row by row basis, but this is very slow and if the connection goes down halfway then pretty much buggered.



What is the best, reliable and fastest way to copy data across internet (several thousand rows), I have read about Bulk Insert etc... but also how would get around an upload and crashes half way, is there a way of uploading and until the whole upload goes through then the data is inserted into the database.



Would appreciate any guidance.



Richard

View 3 Replies View Related

Invisible Data

Aug 23, 2005

I am facing a problem of invisible data. I have developed a ASP based application in my local laguage and data is entered from 8 clients. Now I have found that in a particular table in the SQL Server very few data is not visible if I see from the SQL query analyzer. But if I go the application and try to enter the data again it gives a message that the data already exist and next time if i see it from query analyzer the data is displayed.

Please help.

Bidyut Rn. Gohain

View 3 Replies View Related

What Is That Invisible Character?

Feb 27, 2008

Hey, everybody,

I need your help on figuring out what is this invisible character in one of my data column.

The file is from IBM DB2 as text. I am comparing the data with the one in SQL server. There is one white space at the end of the column I couldn't get rid off.

The text strings from both side look idential except the DB2 one has a "space" at the end.

The len() show it's 13, while the sql one is 12. However, the rtrim()/ltrim() did not get rid of it.

This column is at the end of the row. So it could be CR or LF.

To use padindex or stuff functions, I need to know what is this stuff.

Talking about working hard for "NOTHING".

Thanks!

View 2 Replies View Related

Invisible Components

Aug 10, 2007

I am not sure why when the packages are run, the components dissapear. The only thing I see is the result in the output.
So there is no visual on the tabs.
Thanks

View 11 Replies View Related

Is 2005 Merge Replication Reliable For Compact Edition Subscribers On WinXP Tablets Over VPN?

Oct 24, 2007


I posted a more detailed technical question a couple of weeks ago
with Subject = "Compact Edition 2005 Subscribers - Merge Agent failed after detecting that retention-based cleanup has deleted metadata"
But I got no replies.

Now my question is simpler: Is SQL Server 2005 Merge Replication reliable with Compact Edition subscribers on WindowsXP tablets?

We deleted all users' local databases a couple of weeks ago, and republished two publications with retention = 60 days.
Now we have at least one user who can't sync with the server, and replication monitor shows the error below.
But if she e-mails her sdf file to a support person, they can successfully sync her database.
We're sure that it's not a permissions issue, which is a normal suspicion when one user can perform a task that another can not.
It doesn't seem like a retention problem, because she's well inside the retention period.
She can successfully sync with the publication with upload/download tablers, but not with the publication with download only tables. Both publications were created on the same day, by the same DBA, with nearly identical properties.

This problem user has operated in the past with no problem, and she's configured identically to all of the others. It just seems like random flakyness with merge replication for Compact Edition subscribers.

I feel stupid saying that, because it sounds like I believe in a magical ghost in the machine. So my question is - IS MERGE REPLICATION A LITTLE BIT FLAKY FOR COMPACT EDITION SUBSCRIBERS ON XP MACHINES?


We've applied SP2 to the server, but no subsequent HotFixes.

We're trying to sell users and management on developing a larger occasionally connected system with the same replication scheme, so we need to know if it deserves our confidence.


Error messages:

The Merge Agent failed after detecting that retention-based metadata cleanup has deleted metadata at the Publisher for changes not yet sent to the Subscriber. You must reinitialize the subscription (without upload). (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199402)
Get help: http://help/MSSQL_REPL-2147199402

View 2 Replies View Related

DBO Invisible In User List

Mar 20, 2002

Recently found a situation which I can not figure out the cause. Wish somebody can help me here.

The scenario is as follows:

Server: SQL 7.0 with SP2
login name: DBA, standard SQL login, member of sysadmins
DB Name: TEST

DBA is the owner of database TEST and a member of db_owners in the database. Using EM, if you look at Users in TEST database, the only entry you can find is DBA where both Names (user name Login Name) are the same: DBA. There's no entry for user dbo. (from BOL, dbo can not be deleted)

Run sp_helpuser gives out two rows.
user login name
dbo NULL
DBA DBA

I don't know what happened to this machine before. Any clue about the possible cause is highly appreciated.

Hong

View 1 Replies View Related

My Reports Folder Is Invisible

May 9, 2007

I am trying to locate the "My Reports" folder on the SSRS site, but I dont think I am able to see it. I am an admin on the box with Browser, Content Manager, My Reports roles.



I also tried creating the folder manually and it says the folder exists but I cant see it.



I have also checked on the "Site Settings" and checked the box "Enable My Reports". What else am I missing here?



Thanks,

sj

View 2 Replies View Related

Any Way To Run A Invisible Trace On Security Audit?

Apr 21, 2004

Is there anyway I could run an Audit trace on SQl Server which records SQL Server System Admin Login/Logout , failed login and machine names I don't want the trace window to show on screen however would like a file generated for later viewing. Also due to Firewall issues we have, We don't have SQL tools enabled to connect to that server.

View 2 Replies View Related

How To Create Invisible Table In 2005?

May 6, 2008

Hi,

Can I create invisible table in SQL Server 2005?
Access(all versions) has this option if you add Usys_TableName.
The table will be invisible, but you can get data from it


Mark

View 6 Replies View Related

+/- For Toggling Visible And Invisible Groupings

Mar 17, 2007

When defaulted to Visible or Invisible, +/- displays correctly. But when using the Expression, + is always showing as the default even when a group is expanded. Is this expected? TIA.



View 5 Replies View Related

Invisible Rows After Failed Syncronization

Nov 9, 2006

Publisher: SQL Server 2000 SP4
Subscriber: SQL Server 2005 Mobile Edition

Sometimes, after a failed merge replication(due to communication error) some rows on the subscriber became invisible for the publisher.

I've reproduced a case:

[START Short Version]
All rows inserted between a comm failed sync and a fine sync became invisible.
This seems to be caused because the subscriber keeps generating rows with the same generation number and the publisher doesn't look for this generation anymore.
[END Short Version]

[START Detailed case]
STEP 0: INITIAL STATE
Publisher
Orders Table
EMPTY

Subscriber
NO DATABASE


STEP 1: After FIRST SYNC and INSERTING 2 Orders

Publisher

Orders Table

EMPTY



Subscriber

Orders Table
OrderId __sysIG __sysCG __sysMC000001 4 4 81000002 4 4 81


STEP 2: After SECOND SYNC


Publisher


Orders Table

OrderId



000001
000002



Subscriber


Orders Table

OrderId __sysIG __sysCG __sysMC

000001 4 4 80

000002 4 4 80


STEP 3: INSERT ANOTHER ORDER



Subscriber



Orders Table


OrderId __sysIG __sysCG __sysMC


000001 4 4 80


000002 4 4 80



000003 6 6 81



STEP 4: After THIRD SYNC (with comm error)
Error: [NativeError:28037][HRESULT:-2147012889]->[A request to send data to the computer running IIS has failed. For more information, see HRESULT.]
When: Error happens provoked after sending from Subscriber to Publisher but before ending syn process.
Publisher




Orders Table



OrderId





000001



000002



000003







Subscriber




Orders Table



OrderId __sysIG __sysCG __sysMC



000001 4 4 80



000002 4 4 80




000003 6 6 81
Note: Publisher has the row but subscriber keeps the state in 81.



STEP 5: INSERT ANOTHER ORDER (BEFORE A GOOD SYNC)




Subscriber




Orders Table



OrderId __sysIG __sysCG __sysMC



000001 4 4 80



000002 4 4 80




000003 6 6 81




000004 6 6 81
Note: Orders 000003 and 000004 have the same system info



STEP 6: After FOURTH SYNC
Publisher






Orders Table





OrderId







000001





000002





000003











Subscriber






Orders Table





OrderId __sysIG __sysCG __sysMC





000001 4 4 80





000002 4 4 80






000003 6 6 81







000004 6 6 81

Note: Even with a fine merge process Publisher didn't get the 000004 row and the Subscriber didn't update the __sysMC




STEP 7: INSERT ANOTHER ORDER





Subscriber





Orders Table




OrderId __sysIG __sysCG __sysMC




000001 4 4 80




000002 4 4 80





000003 6 6 81





000004 6 6 81





000005 8 8 81




STEP 8: After FIFTH SYNC

Publisher







Orders Table






OrderId








000001






000002






000003
000005













Subscriber







Orders Table






OrderId __sysIG __sysCG __sysMC






000001 4 4 80






000002 4 4 80







000003 6 6 81








000004 6 6 81






000002 8 8 80


Note: Data from generation 8 merge correctly, but data from generation 6 keeps invisible to publisher.





STEP 9: DUMMY UPDATE ON GEN 6 ROWS






Action: I made a non relevant update to force the Subscriber update the generation.
Subscriber






Orders Table





OrderId __sysIG __sysCG __sysMC





000001 4 4 80





000002 4 4 80






000003 6 10 81






000004 6 10 81






000005 8 8 80

Note: sysCG get its value updated correctly.





STEP 10: After SIXTH SYNC


Publisher








Orders Table







OrderId









000001







000002







000003
000004

000005















Subscriber








Orders Table







OrderId __sysIG __sysCG __sysMC







000001 4 4 80







000002 4 4 80








000003 6 6 80








000004 6 6 80







000002 8 8 80



Note: Data merges correctly.






[END Detailed case]

I could code a system that checks all the publication tables and updates all the last generation rows in case of communication error but i would really like to avoid doing it.

I don't know if I'm missing something or if this is a bug or a known issue.

This is a big problem for me because communication errors on cellular phone based connection are quite common and users keep working even if there's an error.

Any comment will be appreciated.

View 6 Replies View Related

Sorting Makes Table Invisible

Sep 13, 2006

I have a table which visibility can be toggled by a text box. By default it is invisible. After it is made visible, clicking a sortable column header makes the table invisible. Does this mean sorting makes the table go back to its default visibility?



View 3 Replies View Related

How Do You Make A Report Parameter Invisible???

Jun 4, 2007

Hi, I have 3 report parameters.

If a user selects 'value1' from the first parameter list then parameter list 2 & 3 should be open for the user to make their selection. BUT if the user selects 'value2' from parameter 1 then only parameter list 2 should be open and parameter list 3 invisible. Is this possible??

View 4 Replies View Related

Invisible Controls Durig Runtime

Jul 25, 2007

Hi,
Do you know why when I run my ssis packages in the dev machine, the diagrams are not visible during run time.
I can design the package but not sure why when I start the package, the diagrams in the control flow can not be viewed.
Please note that if I do this on the server, I can see the diagrams during run time.

Thanks

View 2 Replies View Related

How To Make Table Row Invisible Based On Certain Condition

Apr 16, 2008



HI

I have the following scenario in my report.


-The data is displayed in a table
-The table groups by one field
-Each table row calls a subreport
-There is about 6 paramaters in the report
-The last paramater of the list of paramters is a multivalue paramater and based on what is selected in the list the corresponding subreport must be shown.
-So i use a custom vbscript funtion to determine if a specific value was selected or not.
This functionality is working fine.

My problem is if the user does not select all the values in the multi select then i want to make the row invisble
and remove the whitespace so that there is not a gap between the other subreports which is shown.

I can make the subreport invisible inside the row but there is still the white space which does not display very nicly.

How can i make the row invisible if the vbscript function that is called returns a false value?

Here is the funtion I call -> Code.InArray("ValueToSearchFor", Parameters!MultiValueDropDown.Value)

The Function returns a true or false.

Thanks.




View 3 Replies View Related

How To Handle Invisible Characters On An Account Number

Dec 6, 2007



I am joining on table A AND Table B ON the accountnumber field. The accountnumber on the tblB has some invisble characters at the end, ie "12344 ". The Table A does not have these invisble chars and is "12344".
Due to the extra spaces at the end, the join fails and does not find a match for that acctno. I have used ltrim(rtrim) hoping that will elimante the extra spaces and find a match.
Heres my qry:

select * from Tbla a
inner join tblb B
on ltrim(rtrim(ACCTNO))=ltrim(rtrim(ACCT))

How do I do this, so that it finds a match and returns the acctno.

View 2 Replies View Related

DTS Experts - Help

Feb 12, 2001

Hi,

I've taken up maintaining new server where there were
50+ DTS packages scheduled. How do I document those tasks?
I know the methods of copy to file as dts and cOM objects.
Is there a way to copy it in readable format like VB or Sql?

Thanks

Sam

View 1 Replies View Related

Need Help From Experts

Apr 26, 2004

[FONT=Garamond][COLOR=RoyalBlue][SIZE=2]

Hi guys,

Scenario:
We are currently running an Accounting software in Visual Foxpro 8. All are freetables. We are migrating the whole VFP database to sql server 2000 to provide better service to our users. The leagacy VFP system currently running on the production server. Our intension is to migrate the whole system concurrently without intervening/down the system. We found a feasible way to import data from VFP8 with the help or OLEDB VFP.Now I am the one who needs to take care of the Data Synchronization between VFP and Sql Server. I am quite new to DBA routines. I don't have fair idea to synchronize between VFP and SQL Server 2000. If anybody can suggest which replication methodology can I follow to replicate between VFP and SQL SERVER 2000 or even do some DTS routine to achive this. I hope so there should be way to do it in SQL SERVER 2000 :confused: :confused: .

Please guide me to do this....

View 2 Replies View Related

Where Are The SQL Experts At? Help Please.

Apr 16, 2008

I have the following query. I have two problems with this. For each Region I should only have a CustomerNumber listed once with their SOExtChargeAmount summed. I have some showing up more than once.

The second problem is that after my UNION ALL I need to sum 'AllOthers' as one row of data. I can't figure this out. Any help would be absolutely awesome. Thanks.


SELECT
Region, Location, WarehouseCode, CustomerNumber, CustomerName, MonthLessEleven, MonthLessTen, MonthLessNine, MonthLessEight, MonthLessSeven,
MonthLessSix, MonthLessFive, MonthLessFour, MonthLessThree, MonthLessTwo, MonthLessOne, CurrentMonth, CurrentYearTotal, LastYearYTD,
LastYearTotal, CustRank

FROM
(
SELECT

casewhen substring(gla.Account,5,3) = '936' then 'North Region'
when substring(gla.Account,5,3) = '908' then 'East Region' ELSE 'Unknown'END AS Region,

case
when substring(gla.Account,5,3)='900' then 'ALE'
when substring(gla.Account,5,3)='902' then 'ATO'
when substring(gla.Account,5,3)='904' then 'BOW'
when substring(gla.Account,5,3)='906' then 'BRY'
when substring(gla.Account,5,3)='908' then 'BPT'
when substring(gla.Account,5,3)='910' then 'BYD'
when substring(gla.Account,5,3)='912' then 'BUF'
when substring(gla.Account,5,3)='914' then 'CLE'
when substring(gla.Account,5,3)='916' then 'GRN'
when substring(gla.Account,5,3)='920' then 'DXN'
when substring(gla.Account,5,3)='924' then 'CTH'
when substring(gla.Account,5,3)='926' then 'ELC'
when substring(gla.Account,5,3)='928' then 'FTL'
when substring(gla.Account,5,3)='930' then 'FTW'
when substring(gla.Account,5,3)='932' then 'I35'
when substring(gla.Account,5,3) IN ('936','000') then 'GAI'
when substring(gla.Account,5,3)='939' then 'STW'
when substring(gla.Account,5,3)='940' then 'GRE'
when substring(gla.Account,5,3)='942' then 'HEN'
when substring(gla.Account,5,3)='944' then 'FTS'
when substring(gla.Account,5,3)='948' then 'JAC'
when substring(gla.Account,5,3)='952' then 'JEN'
when substring(gla.Account,5,3)='956' then 'KIL'
when substring(gla.Account,5,3)='957' then 'MCA'
when substring(gla.Account,5,3)='958' then 'MIN'
when substring(gla.Account,5,3)='960' then 'NOC'
when substring(gla.Account,5,3)='962' then 'ODE'
when substring(gla.Account,5,3)='964' then 'BTP'
when substring(gla.Account,5,3)='966' then 'RA'
when substring(gla.Account,5,3)='968' then 'RIF'
when substring(gla.Account,5,3)='970' then 'SWD'
when substring(gla.Account,5,3)='971' then '3PS'
when substring(gla.Account,5,3)='972' then 'ROC'
when substring(gla.Account,5,3)='976' then 'SJO'
when substring(gla.Account,5,3)='978' then 'SMB'
when substring(gla.Account,5,3)='980' then 'STO'
when substring(gla.Account,5,3)='982' then 'TOL'
when substring(gla.Account,5,3)='984' then 'VEL'
when substring(gla.Account,5,3)='985' then 'CFP'
when substring(gla.Account,5,3)='986' then 'CLM'
when substring(gla.Account,5,3)='988' then 'WHI'
when substring(gla.Account,5,3)='992' then 'WRA'
when substring(gla.Account,5,3)='995' then 'ADM' ELSE 'Unknown'END AS Location,

ihh.WarehouseCode,ihh.CustomerNumber, cm.CustomerName,

SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 11 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessEleven,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 10 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessTen,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 9 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessNine,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 8 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessEight,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 7 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessSeven,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 6 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessSix,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 5 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessFive,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 4 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessFour,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 3 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessThree,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 2 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessTwo,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 1 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessOne,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 0 THEN ihd.SOExtChargeAmount ELSE 0 END) AS CurrentMonth,
SUM(CASE WHEN DATEDIFF([YEAR], ihh.SOTransDate, getdate()) = 0 THEN ihd.SOExtChargeAmount ELSE 0 END) AS CurrentYearTotal,
SUM(CASE WHEN DATEADD([year], - 1, getdate()) > ihh.SOTransDate AND DATEDIFF([YEAR], ihh.SOTransDate, getdate()) = 1 THEN ihd.SOExtChargeAmount ELSE 0 END) AS LastYearYTD,
SUM(CASE WHEN DATEDIFF([YEAR], ihh.SOTransDate, getdate()) = 1 THEN ihd.SOExtChargeAmount ELSE 0 END) LastYearTotal,

ROW_NUMBER() OVER(PARTITION BY
casewhen substring(gla.Account,5,3) = '936' then 'North Region'
when substring(gla.Account,5,3) = '908' then 'East Region' ELSE ' 'END
ORDER BY
casewhen substring(gla.Account,5,3) = '936' then 'North Region'
when substring(gla.Account,5,3) = '908' then 'East Region' ELSE ' 'END,
SUM(CASE WHEN DATEDIFF([YEAR], ihh.SOTransDate, getdate()) = 0 THEN ihd.SOExtChargeAmount ELSE 0 END) desc) AS CustRank


FROMMAS_BIF_AR1_CustomerMaster AS cm INNER JOIN
MAS_BIF_ARN_InvHistoryHeader AS ihh ON cm.CustomerNumber = ihh.CustomerNumber INNER JOIN
MAS_BIF_ARO_InvHistoryDetail AS ihd ON ihh.InvoiceNumber = ihd.InvoiceNumber INNER JOIN
MAS_BIF_GL_Account AS gla ON ihd.SOGLSalesAcct = gla.AccountKey


GROUP BYihh.CustomerNumber, cm.CustomerName, gla.Account, ihh.WarehouseCode
) X

WHERECustRank < 20


union all

SELECT
Region, Location, WarehouseCode, 'AllOthers', CustomerName, MonthLessEleven, MonthLessTen, MonthLessNine, MonthLessEight, MonthLessSeven,
MonthLessSix, MonthLessFive, MonthLessFour, MonthLessThree, MonthLessTwo, MonthLessOne, CurrentMonth, CurrentYearTotal, LastYearYTD,
LastYearTotal, 20

FROM
(
SELECT

casewhen substring(gla.Account,5,3) = '936' then 'North Region'
when substring(gla.Account,5,3) = '908' then 'East Region' ELSE 'Unknown'END AS Region,

case
when substring(gla.Account,5,3)='900' then 'ALE'
when substring(gla.Account,5,3)='902' then 'ATO'
when substring(gla.Account,5,3)='904' then 'BOW'
when substring(gla.Account,5,3)='906' then 'BRY'
when substring(gla.Account,5,3)='908' then 'BPT'
when substring(gla.Account,5,3)='910' then 'BYD'
when substring(gla.Account,5,3)='912' then 'BUF'
when substring(gla.Account,5,3)='914' then 'CLE'
when substring(gla.Account,5,3)='916' then 'GRN'
when substring(gla.Account,5,3)='920' then 'DXN'
when substring(gla.Account,5,3)='924' then 'CTH'
when substring(gla.Account,5,3)='926' then 'ELC'
when substring(gla.Account,5,3)='928' then 'FTL'
when substring(gla.Account,5,3)='930' then 'FTW'
when substring(gla.Account,5,3)='932' then 'I35'
when substring(gla.Account,5,3) IN ('936','000') then 'GAI'
when substring(gla.Account,5,3)='939' then 'STW'
when substring(gla.Account,5,3)='940' then 'GRE'
when substring(gla.Account,5,3)='942' then 'HEN'
when substring(gla.Account,5,3)='944' then 'FTS'
when substring(gla.Account,5,3)='948' then 'JAC'
when substring(gla.Account,5,3)='952' then 'JEN'
when substring(gla.Account,5,3)='956' then 'KIL'
when substring(gla.Account,5,3)='957' then 'MCA'
when substring(gla.Account,5,3)='958' then 'MIN'
when substring(gla.Account,5,3)='960' then 'NOC'
when substring(gla.Account,5,3)='962' then 'ODE'
when substring(gla.Account,5,3)='964' then 'BTP'
when substring(gla.Account,5,3)='966' then 'RA'
when substring(gla.Account,5,3)='968' then 'RIF'
when substring(gla.Account,5,3)='970' then 'SWD'
when substring(gla.Account,5,3)='971' then '3PS'
when substring(gla.Account,5,3)='972' then 'ROC'
when substring(gla.Account,5,3)='976' then 'SJO'
when substring(gla.Account,5,3)='978' then 'SMB'
when substring(gla.Account,5,3)='980' then 'STO'
when substring(gla.Account,5,3)='982' then 'TOL'
when substring(gla.Account,5,3)='984' then 'VEL'
when substring(gla.Account,5,3)='985' then 'CFP'
when substring(gla.Account,5,3)='986' then 'CLM'
when substring(gla.Account,5,3)='988' then 'WHI'
when substring(gla.Account,5,3)='992' then 'WRA'
when substring(gla.Account,5,3)='995' then 'ADM' ELSE 'Unknown'END AS Location,

ihh.WarehouseCode,ihh.CustomerNumber, cm.CustomerName,

SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 11 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessEleven,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 10 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessTen,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 9 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessNine,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 8 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessEight,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 7 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessSeven,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 6 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessSix,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 5 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessFive,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 4 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessFour,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 3 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessThree,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 2 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessTwo,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 1 THEN ihd.SOExtChargeAmount ELSE 0 END) AS MonthLessOne,
SUM(CASE WHEN DATEDIFF([MONTH], ihh.SOTransDate, getdate()) = 0 THEN ihd.SOExtChargeAmount ELSE 0 END) AS CurrentMonth,
SUM(CASE WHEN DATEDIFF([YEAR], ihh.SOTransDate, getdate()) = 0 THEN ihd.SOExtChargeAmount ELSE 0 END) AS CurrentYearTotal,
SUM(CASE WHEN DATEADD([year], - 1, getdate()) > ihh.SOTransDate AND DATEDIFF([YEAR], ihh.SOTransDate, getdate()) = 1 THEN ihd.SOExtChargeAmount ELSE 0 END) AS LastYearYTD,
SUM(CASE WHEN DATEDIFF([YEAR], ihh.SOTransDate, getdate()) = 1 THEN ihd.SOExtChargeAmount ELSE 0 END) LastYearTotal,

ROW_NUMBER() OVER(PARTITION BY
casewhen substring(gla.Account,5,3) = '936' then 'North Region'
when substring(gla.Account,5,3) = '908' then 'East Region' ELSE ' 'END
ORDER BY
casewhen substring(gla.Account,5,3) = '936' then 'North Region'
when substring(gla.Account,5,3) = '908' then 'East Region' ELSE ' 'END,
SUM(CASE WHEN DATEDIFF([YEAR], ihh.SOTransDate, getdate()) = 0 THEN ihd.SOExtChargeAmount ELSE 0 END) desc) AS CustRank


FROMMAS_BIF_AR1_CustomerMaster AS cm INNER JOIN
MAS_BIF_ARN_InvHistoryHeader AS ihh ON cm.CustomerNumber = ihh.CustomerNumber INNER JOIN
MAS_BIF_ARO_InvHistoryDetail AS ihd ON ihh.InvoiceNumber = ihd.InvoiceNumber INNER JOIN
MAS_BIF_GL_Account AS gla ON ihd.SOGLSalesAcct = gla.AccountKey

GROUP BYihh.CustomerNumber, cm.CustomerName, gla.Account, ihh.WarehouseCode
) X

WHERECustRank > 19

View 8 Replies View Related

EXPERTS HELP

Jul 24, 2007

How can I download a report model from report server into a folder programmatically?

View 3 Replies View Related

Qs. For The Experts Here...Help!

Mar 15, 2007

We are doing a community wide project where we need to extract phone numbers and emails from over 1000s local non-profit and gov. webpages. Any suggestion on the best tool outthere that could help us automate this somewhat?

View 1 Replies View Related

EXPERTS HELP

Jun 19, 2007

ANYONE, FAMILIAR WITH THIS.....





REPORT MODEL> ADD NEW ITEM>AUTO GENERATE>CLOSE SOLUTION>OPEN SOLUTION>OPEN MODEL>VIEW DESIGNER



"THE PROCESS COMPLETED SUCCESSFULLY"



YET A WARNING MESSAGE OF ERROR...

View 7 Replies View Related

After Sorting Textbox Is Getting Collapsed Making Table Invisible

Apr 15, 2008


Hi.



I found unpleasant issue within RS:

1. Imagine RS report with Table(with interactive sorting) whose visibility is toggled by Textbox:


2. After sorting the Table the Textbox is getting collapsed making the Table invisible. But the Table should remain visible.

Is this MS bug? Are there workarounds?

If my question is not understandable I can send simple *.rdl report with sample.

Thank you in advance for help.

View 7 Replies View Related

How To Know When A Job Has Finished. For Experts I Think.,

Apr 29, 2004

I have this on my page
Dim backUpDB2 As SqlClient.SqlCommand
backUpDB2 = New SqlClient.SqlCommand
backUpDB2.CommandType = CommandType.StoredProcedure
backUpDB2.CommandText = "msdb.dbo.SP_RESUMENFAC"
backUpDB2.Connection = SqlConnection1
backUpDB2.ExecuteNonQuery()


The SP has this

CREATE PROCEDURE .[SP_RESUMENFAC] AS

EXEC sp_start_job @job_name = 'TransferirDatos(FACT) '

GO

WHen I execute the page after the SP it fills some datagrid but the data is not updated bacuase the job takes 1 minute or more to finish.

Is there anyway to prevent to show the old data? or to detect when the job has finished?

Thanks

View 6 Replies View Related

Help From Experts With A SQL Statement

Jun 17, 2003

Hello all I am trying to write a SQL Statement that will return the fields specified in the Select. However, in some occassion there is no data located in the PS_LEDGER_BUDG C table. I would like to return a zero if possible. When there is no data located in PS_LEDGER_BUDG certain data does not show up. Here is the SQL Statement:

SELECT
A.BUSINESS_UNIT,
A.JOURNAL_ID,
A.JOURNAL_DATE,
B.DEPTID,
B.ACCOUNT,
B.PROJECT_ID,
B.TOTAL_EST_AMOUNT,
C.POSTED_TOTAL_AMT,
B.LEGIS_REF_NBR,
A.OPRID,
B.BUDGET_PERIOD,
A.ACCOUNTING_PERIOD
FROM PS_BUD_JRNL_HEADER A, PS_BUD_JRNL_LN B,
PS_LEDGER_BUDG C
WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT
AND A.JOURNAL_ID = B.JOURNAL_ID
AND A.JOURNAL_DATE = B.JOURNAL_DATE
AND A.UNPOST_SEQ = B.UNPOST_SEQ
AND A.BUSINESS_UNIT = C.BUSINESS_UNIT
AND B.ACCOUNT = C.ACCOUNT
AND B.DEPTID = C.DEPTID
AND B.BUDGET_PERIOD = C.BUDGET_PERIOD
AND B.PROJECT_ID = C.PROJECT_ID
AND C.FISCAL_YEAR = 9999
AND A.JRNL_HDR_STATUS = 'V'
AND A.OPRID = 'ENRI'

I would greatly appreciate any suggestions. Thank you in advance.

David.

View 3 Replies View Related







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