Security Part 2

Oct 13, 2006

I think I'm having problems because I don't really understand "Windows Authentication".

I've looked on the web and haven't seen any real explinations.

As an example, If I have 3 computers

1.ServerBox (xp pro) with SQL express (using Workgroups not Domains)

2 Laptop1

3 Laptop2

ServerBox and Laptop1 connected with cat5 or Wirless..Works fine.

Laptop2 connected with wirless. I see laptop2 in the serverbox "Network Places-Workgroup" on the serverbox

Laptop 1 has xp pro and uses sql authentication for "instance, db, usernane and password". Logging in is no problem (I use SQL authentication in connection string)

Laptop 2 has xp home edition and dosn't have to log in. I have the machine name, default user with no password and try Windows authentication. Does not work. error show:

Cannot open database "db1" requested by the login. I use Windows authentication connection string.

I've tested both connection strings in Laptop1 and they both work.

Does Windows Authentication read the clients login to his Windows Home Edition, and if so, does in need a password (I know its a good idea)..

So Laptop2 login to his Windows Home edition is Username=Jim and no password (shows administrator rights in his box.

View 2 Replies


ADVERTISEMENT

SQL Security :: Users Are Able To Login To Server Without Any Login Names Or Being Part Of A Group

Jun 5, 2015

I have a server that has 20 databases . I have tested with few users with different level of access and all of them were able to connect to the server and also see, select, update , delete from a particular database which is kind of weird because they do not have a user login associated or mapped to that database. I checked and no user is part of any group in AD that would give them permission to connect . I need a query that would find the permission path of a user. I already queried with xp_logininfo but I am not getting any thing.

View 9 Replies View Related

Web Part Deserialization Error When Trying To Change Report Viewer Web Part Programmatically.

Oct 29, 2007



I have SSRS 2005 SP2 configured to work in Sharepoint integration. Everything works fine except that I am not able to programmatically change any property of report viewer web part (instance) that I have added on on home page of my sharepoint site.
I can do same thing via sharepoint UI but not through program. When my programs runs it fetches all web parts been added on home page, then I need to iterate through each one and find report viewer web part.
While iterating, as soon as I arrive to report viewer web part it is named as "Error web part" with error message as
"Windows SharePoint Services cannot deserialize the Web Part. Check the format of the properties and try again"

If someone has a solution, please respond at your earlist.

Thanks

Shankar

View 1 Replies View Related

Split A Decimal Number Into The Integer Part And The Fraction Part

Dec 7, 2007

I have a table with a column named measurement decimal(18,1).  If the value is 2.0, I want the stored proc to return 2 but if the value is 2.5 I want the stored proc to return  2.5.  So if the value after the decimal point is 0, I only want the stored proc to return the integer portion.  Is there a sql function that I can use to determine what the fraction part of the decimal value is?  In c#, I can use
dr["measurement "].ToString().Split(".".ToCharArray())[1] to see what the value after the decimal is.

View 3 Replies View Related

SQL 2012 :: Function With 2nd Part Working On Results 1st Part

Jan 28, 2015

I have made the following Scalar-valued function:

CREATE FUNCTION [dbo].[TimeCalc]
(
@OriginalTime AS INTEGER
, @TenthsOrHundredths AS INTEGER -- code 2: 1/10, code 4: 1/100
)
RETURNS NVARCHAR(8)

[Code] ....

What it does is convert numbers to times

E.g.: 81230 gets divided by 10 (times in seconds: 8123). This 1 1 full minute, and the remainder = 2123 making it 1.21.23 mins)

So far so good (function works perfectly)

My question: sometimes times are in 1/100 (like above sample), sometimes in 1/10.

This means that, e.g. with a time like 3.23.40 the last zero must be deleted.

My thoughts are to use the results from the Return Case part, and as the code = 4: leave it as it is,

is the code 2 the use LEFT(... result Return Case ..., Len(..result Return Case.. - 1))

There are 5 codes: 0 1 2 3 and 4

View 9 Replies View Related

SQL 2012 :: Persist Security Info And Integrated Security In Connection String

Dec 4, 2014

I use from sql server 2008. and c#

what is the best connectionstring?

I don't know if i use Persist Security Info and Integrated Security or not?

And if yes then their value must be true or false?

View 1 Replies View Related

Code Access Security Across Multiple Assembly Security Extension

Oct 14, 2005

Hello there I have trying to figure out for days how to enable FullTrust for my Reporting Services security extension.

View 9 Replies View Related

SSRS -- Security Filter And Model Item Security Setting

Jul 31, 2007



Hi,


I have posted this issue for a week, haven't got any reply yet, I posted it again and desperately need your help.


The article http://msdn2.microsoft.com/en-us/library/ms365343.aspx says:
Model Item Security can be set for differnt security filters, but when I use SQL Server Management Studio to set Model Item Security, it seems "Permissions" property surpass "Model Item Security" property. -- My report server is using Custom Authentication.



For example, in "Permissions" property of the model, if I checked "Use these roles for each group or user account" without setting any user or group, no matter what users I added to "Model Item Security" with "Secure individual model items independently for this model" checked, NO one user can see the model on report manager and report builder;

in above situation, if I added "user1" and gave role such as "Browser" role to "user1" in "Permissions" property, if I checked "Secure individual model items independently for this model" in "Model Item Security" property, even I did NOT grant "user1" to root model and any entities under the model, the "user1" is able to access the model and all entities in report builder.



My question is on the same report model, how to set "AdminFilter" (empty security filter) for administrator permissions and set "GeneralFilter" (filtered on UserID) for general user based on their UserID?


The article also says:

"Security filters are always applied, even for users who have Content Manager or Administrator permissions to the model. To allow administrators or other users to see all rows of an entity on which row-level security is defined, you can create an empty security filter (which always returns True) and then use the filter to grant those users access to all the rows."



So I defined 2 filters "GeneralFilter" and "AdminFilter" for "Staff" entity for my report model "SSRSModel", I expect after I deployed the report model, the administrator users use report builder to build reports with all rows available, and the non-admin users can only see rows based on their UserID.



I can only get one result at a time but not both:

either the rows are filtered or not filtered at all, no matter how I set the "SecurityFilter" for the entity: I tried setting both "AdminFilter" and "GeneralFilter" for SecurityFilter at the same time, combination of "DefaultSecurityFilter" and "SecurityFilter", or one at a time.



Your help is highly appreciated!

Desperate developer

View 1 Replies View Related

Differance Between Persist Security Info And Integrated Security

Apr 26, 2007

hi i want to know what is the differance between  
Persist Security Info=False;Integrated Security=Yes;

View 1 Replies View Related

SQL Security :: Running Job As Windows Security Group

Oct 18, 2015

Is there any possibility to schedule SQL job execution as Windows Security Group? I need to run powershell script through SQL job with one of this group member's permissions. 

View 4 Replies View Related

Setup Of Security / Integrated Win Security On Vista

Jul 6, 2007

I have Sql Server Express installed on Vista (service pack 2)

I have Visual Studio 2005 with an application that I'm trying to access it with within a WCF service.



The login ID of the service is added to the database.

The database has remote access turned on.

The ID is granted access to all databases within the server.

The thread is being set with WindowsProvider and the services set their thread to WindowsProvider.

The dataserver is set with using Windows Authentication for security.



When I open my connection to the database, though, it reports the typically useless message that the connection is not allowed and that the server may not allow remote connections.



How to I get past this? I've done everything right.

View 1 Replies View Related

Use An Existing AD DL Security Group For Security Role

Jun 18, 2007

I want to use an Active Directory security group that is a Distribution List for a new role assignment for an existing report. Can someone tell me if this is possible? I get an error each time I try:














The user or group name <DLName> is not recognized. (rsUnknownUserName)"

View 1 Replies View Related

What Different Are There Between ConnectionString (Part 1) And ConnectionString (Part 2) In Web.config

Apr 12, 2006

What different are there between connectionString (Part 1) and connectionString (Part 2) in web.config
The CCWW is my PC's name, normally I can connect to the database ASPNETDB.MDF correctly either Part 1 or Part 2 in a web page,After I open Database Explorer panel and browse ASPNETDB.MDF, I can't connect to database using Part 2 when I open a webpage in Microsoft Visual Web Developer 2005 Express Edition,but I can correctly open a webpage using Part 1 after I open Database Explorer panel.
What different are there between connectionString (Part 1) and connectionString (Part 2) in web.config?
I guess  while I use Part 1 to connect, maybe it will be cancel exclusive method of the database  ASPNETDB.MDF first, but when I connect to database using Part 2, maybe two programms both Part 2 and Database Explorer visit ASPNETDB.MDF at the same time!
 
--------------------------------------Part 1------------------------------------------------------------------------<add name="MyConnect" connectionString="Data Source=.SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|ASPNETDB.MDF"          providerName="System.Data.SqlClient" />  --------------------------------------Part 1------------------------------------------------------------------------
--------------------------------------Part 2------------------------------------------------------------------------<add name="MyConnect"  connectionString="Data Source=CCWWSQLEXPRESS;Initial Catalog=ASPNETDB.MDF;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|ASPNETDB.MDF"     providerName="System.Data.SqlClient" />--------------------------------------Part 2------------------------------------------------------------------------

View 2 Replies View Related

SQL 2K Security Baseline Or Security Checklist

Jul 20, 2005

Is there anybody out there with a MS SQL 2K Security Baseline orSecurity Checklist. Where can I get one????Thanks in advanceDavid

View 1 Replies View Related

SQL Security Events In Windows Security Log

Feb 28, 2008



Hi;

I am looking for a way to log all security related events for SQL in Windows Security Log. I am trying to use SCOM for monitoring SQL and I am looking at ways to generate alerts in my SCOM Console for specific events in SQL e.g. A table is deleted, user is modified, deleted, etc. Is this possible and if yes how do I achieve the same?

Rgds;

View 6 Replies View Related

Transport Security Vs Dialog Security

Aug 3, 2006

In an environment where there are many initaitors speaking to a central target with frowarders in between, from what i can understand this best policy is to disable encryption on the endpoints, since dialog encryption will be enforced this is all that is really required, is this correct.

If the endpoints used encryption the message would need to be encrypted and decrypted at each forwarder resulting in slower perfromance, where as dialog encryption would only encrypt at the sender and decrypt at the target, so is this the best way to go?

Secondly is it best practice to open a dialog initally and send messages over this dialog for years never ending the conversation? This way the services only have to authenticate eachother once, if there are no reboots etc that is of course.

I would think performance wise sending each message and ending the conversation each time is a much greater overhead ? So would it be best practice to keep dialogs open and keep sending messages ?

Initally when i was learning service broker i thought that one must send a message and end the dialog until the next message, but i think the other way is the best option ?

Is this correct ?

Thanx

View 1 Replies View Related

Dialogue Security Vs Transport Security

Feb 19, 2007

Hi

I'm designing a distributed application where I will have SQL Server 2005 distributed databases replicating data to my central hub which is again a SQL Server 2005 database using SQL Service Broker. Data will be sent from the central hub to the distributed sites and vice versa. I need to authenticate the communication and also secure the communication by encrypting the messages. Which security shall I use? Where do I configure the type of security being used? What is the difference between transport security Vs dialogue security - Full security model?



Thanks

View 4 Replies View Related

NT Security Vs SQL Server Security

Jun 19, 2000

Hi:

Can anybody tell me the advantage and disadvantage to use NT security for SQL Server 7.0? For a corporation with 400 users, what is your recommendation for the SQL Server security management. Thanks.

Joan

View 1 Replies View Related

Windows Security Vs. SQL Security

Jul 30, 2004

What's the better security to use? Currently I'm always registering using the Windows authentication. When I'm trying to register using SQL authentication I always get "Login failed for user 'sa'" error....

View 1 Replies View Related

64 Bit(part II)

Jun 23, 2006

In a recent post, I've read that Jet Provider is only provided with 32-bit.

I wonder, is there any problem if you run a SSIS package 32-bit which read from Access and then call another SSIS package 64 bit?? We've got quite 2000 dts which pulling data from MDB and within a time it'll disappear in favour 2005 environment .

Another question, what sort of Providers don't offer us 64-bit versions???

Any link or thought will be as usual welcomed

View 4 Replies View Related

Inner Join Part 2

Dec 7, 2006

Getting back way too many records with this on - over 4500 and should only be about 350.....
Here's the sql that's not working right: 
SELECT c.Name, a.ID, a.Description, s.Status, b.Location, a.scheduleBegin, a.scheduleEnd
from tblEquipments a
inner join tblEquipments_Group U on u.categoryID = a.EquipmentType
inner join tblStatus S on a.status = S.statusID
and u.subCategoryID = @type
inner join tblLocation b on a.status = b.locationID
inner join tblSubCategories c on u.subCategoryID = @type
and c.Parent = @type
The table tblSubCategories has a field Name that I need. 
tblSubCategories  has a field, Parent, that will = @type
See this post for the other table fields if needed.
 http://forums.asp.net/thread/1489880.aspx
If I omit the last inner join, all is ok, but I need that last bit of info - the c.Name. 
Suggestions?
Thanks,
Zath
 

View 1 Replies View Related

DATEPART....part Two??

Jan 31, 2008

ok, following up on my previous post that I marked as answered a little premature. The query below works fine in sql studio:
SELECT id, CONVERT(NVARCHAR(10), arrdate,101) as formatedDate
FROM guest
but when I try to use it in a c# code behind file:
comm = new SqlCommand("SELECT id, CONVERT(NVARCHAR(10), arrdate,101) as formatedDate FROM guest WHERE id = @id", conn);
it bombs??

View 5 Replies View Related

How To Get Part Of The Field Value?

Mar 5, 2008

 hi friends.....             i want to get part of the database field value in stored procedure..             ex :     select reason from reasontable where rid=1 output : reason-------------------------------telephone is not working properly. but i want the output as : reason--------------------------------telephone is n.............  

View 3 Replies View Related

Sql Jobs - Part 2!

Nov 17, 2000

Which database do you point it at when you're executing the script?
The Master database?

View 1 Replies View Related

What's The Difference? (Part 2)

Aug 13, 2004

Hi all,

Is there a difference between the DBA and the SA or are they one in the same. I was reading a previous thead and came across that the SA is the powerful God almighty and the DBA is the just God.

Thanks

Lystra

View 3 Replies View Related

Part Of String

Nov 25, 2004

Need help..

I need to select from a text field (lastname, firstname) the first part which is the last name. The format is exactly like the parenthesis. Any ideas?

Thanx

View 3 Replies View Related

Replication Over VPN Part 2

Jun 19, 2008

Thanks everyone for being helpful. I am new to SQL Server and don't have many coworkers so I am relying heavily on this forum's help.

It seems the previous poster on this issue was able to work it out but I am still not able to get it to work.
I have tried using the server URL, the server machine name, the ipaddress with alias, but still cannot connect with the replication over vpn. Any ideas?

Also, how can I set the subscriber from the server? How do I refer to the subscriber machine? Let's say it is my pc that I want to make changes in and have them replicate to the server? When I specify a pull subscription I am not show how to refer to my computer.

View 4 Replies View Related

How Do I Add A Part To A Field?

Jan 30, 2007

I have a tabkle that I want to use for NT authnetication. It was a list of domain lan usernames. I want to use NT authentication in ASP but in order to do so I need to add the domain to each of the lan ds. So my username, kssensalo needs to be DOMAINkssensalo. I need to do this for 5,000+ plus records. What SQL fucntion would I use? I know I can use LTRIM to remove, but I need to add or append.

Any suggesttions?

View 2 Replies View Related

Date Part

Sep 3, 2007

Hi,

i am trying to write a query the pulls out a table which has date information stored as dd/mm/yyy but all i want is the month and the year.

So i tried

select datepart(mm, dtinsertdate)
from incident

which only gives me month and also used

select datepart(year,dtinsertdate) [year], datepart(month, dtinsertdate)[month],

Which works but i want both in the same column.

But when trying to get both mm, yyyy it looks like it only supports one datepart. Is there any way aroung this?

Many Thanks

John

View 8 Replies View Related

100% CPU Usage (Part 2)

Feb 9, 2006

Hi allPlease read my previous post here if this interests you:http://groups.google.co.uk/group/co...pu+usage&hl=en&I have (or rather a colleague has) found the situation that appears tobe causing this problem but I am still no further to finding asolution.It appears that if we execute a query against one particular table inthe database and that query requests data that is not indexed, or acolumn in the where clause is not indexed then this is when problemsoccur.The table cannot be copied using DTS reporting the error:"Error occurred copying row 3 - unspecified error".However, we can query using:"SELECT TOP n FROM <Table>"where n so far has been between 3 and 100000.However we cannot do SELECT * FROM <Table>.All we can guess at for now is that the problem occurs when a query isperformed to try and fetch data that is not indexed, using an index inthe where clause.i.e. SELECT <Non-indexed column> FROM <Table> WHERE <Indexed Column> =nCould it be possible that we have one 'rogue' row in the table somehowthat is causing the problem?The only thing to dispel this is that we can do the following:SELECT * FROM <Table> WHERE ID < 1which returns 1 row with ID = -1.We cannot do:SELECT * FROM <Table> WHERE ID < 200 even though we know that the onlyrecord matching this criteria is the record with ID = -1.Therefore the exact same data should be returned yet one query failsand one works.The actual problem that we see is that memory usage climbsdramatically, then once all memory is used, the CPU usage climbs to100% and stays there until we have to restart SQL Server.Any suggestions on this would be hugely appreciated.Thanks,Paul

View 4 Replies View Related

Part Of SP Not Executing... Maybe BUG!?

May 2, 2006



Hello!

I have a strange problem in one SP. One small part of it wan't execute.

I have pasted whole procedure here and a solution to problem.



So, black on red part of code will not execute if black on blue code is in place.

But, if I supstitute black on blue with black on green, black on red part will execute!



Only thing I want to know is why is that hapening...

Regards



--SNIP--

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_FINKO_Knjizenje_Robnih]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_FINKO_Knjizenje_Robnih]
GO




CREATE procedure sp_FINKO_Knjizenje_Robnih
(
@VrDok varchar(8) = '', --Vrsta robnog dokumenta
@IDs varchar(2200) = '' --IDovi iz HeRPuSPrijenos_Knjizenja
)
AS
BEGIN

set @VrDok = rtrim(ltrim(@VrDok))
set @Ids = rtrim(ltrim(@Ids))

if @VrDok='' OR len(@IDs) = 0
BEGIN
RAISERROR ('Potrebna vrsta dokumenta i IDovi', 16, 1)
return
END
declare @vbCrLf char(2)
declare @SQL_temp nvarchar(4000)


set @vbcrlf = CHAR(13) + CHAR(10)

CREATE TABLE #tmpDokumenti (
[ID] [numeric] (18,0), [Dok_broj] [varchar] (32) COLLATE Croatian_CI_AS NULL, [AK_Skladiste] [varchar] (10) COLLATE Croatian_CI_AS NULL, [Dok_Vrsta] [varchar] (8)COLLATE Croatian_CI_AS NULL
)

set nocount ON
--Racunamo da imamo vrstu dokumenta te ajdiove te cemo sada brojeve dokumenata i skladista prebaciti u temp tablicu
set @SQL_temp= 'SELECT ID,Dok_Broj,AK_Skladiste,Dok_AK FROM HeRPuSPrijenos_Knjizenja' + @vbcrlf
set @SQL_temp= @SQL_Temp + 'WHERE (isnull(Temeljnica_Nastala,0)=0 AND Dok_OA = ''50'' AND Dok_AK=''' + @VrDok + ''')' + @vbcrlf
set @SQL_temp= @SQL_Temp + 'AND ID IN (' + @IDs + ') '

set @SQL_temp= 'SET NOCOUNT ON ' + @vbcrlf + @SQL_temp

INSERT INTO #tmpDokumenti
exec (@SQL_temp) --prebacujemo

SELECT v.oznaka_analitike
,v.Analiticki_konto
,v.Konto
,v.vrsta_dokumenta
,v.broj_dokumenta
,v.Datum_dokumenta
,sum(v.Duguje) as Duguje
,sum(v.Potražuje) as Potražuje
,v.Opis
,v.Vrsta_Temeljnice, v.Broj_Temeljnice, v.Datum_temeljnice
,v.Tecaj, v.Duguje2, v.Potražuje2
,v.Protukonto, v.Protuanalitika, v.ProtuAnliticki_konto
,v.Zatvoreno, v.Mjesec, v.Godina, v.Broj_dnevnika, v.Saldo
,v.Zatvoren_dnevnik, v.Valuta, v.IdNo, IDENTITY(int, 1,1) as rbr
,v.PodOznaka_analitike, v.Podanaliticki_konto
,v.Broj_izvornog_dokumenta, v.Vrsta_dokumentaIzvorni
,v.Broj_dokumentaIzvorni, v.Datum_dokumentaIzvorni
,v.DugujeDEV, v.PotrazujeDEV, v.NovcanaJedinica
,v.ZatvaraDokument
,v.Prijenos_ID, v.Prijenos_DokID
,v.Duguje2DEV, v.Potrazuje2DEV, v.ZatvorenoDEV
,v.Racunalo, v.Korisnik, v.DatumAzuriranja
,v.Prijenos_Dok_Dogadjaj, v.Prijenos_dok_zatvara
,v.Red_ID, v.Tem_ID,v.RVrDok as r_Vrsta_dokumenta
INTO #tmpTemeljnica
FROM vFK_RK as V INNER JOIN #tmpDokumenti as D
ON v.broj_dokumenta=d.dok_Broj AND V.AK_skladiste=D.AK_skladiste AND V.vrsta_dokumenta=@VrDok
GROUP BY v.Oznaka_analitike
,v.Analiticki_konto
,v.Konto
,v.vrsta_dokumenta
,v.broj_dokumenta
,v.Datum_dokumenta
,v.Opis
,v.Vrsta_Temeljnice, v.Broj_Temeljnice, v.Datum_temeljnice
,v.Tecaj, v.Duguje2, v.Potražuje2
,v.Protukonto, v.Protuanalitika, v.ProtuAnliticki_konto
,v.Zatvoreno, v.Mjesec, v.Godina, v.Broj_dnevnika, v.Saldo
,v.Zatvoren_dnevnik, v.Valuta, v.IdNo
,v.PodOznaka_analitike, v.Podanaliticki_konto
,v.Broj_izvornog_dokumenta, v.Vrsta_dokumentaIzvorni
,v.Broj_dokumentaIzvorni, v.Datum_dokumentaIzvorni
,v.DugujeDEV, v.PotrazujeDEV, v.NovcanaJedinica
,v.ZatvaraDokument
,v.Prijenos_ID, v.Prijenos_DokID
,v.Duguje2DEV, v.Potrazuje2DEV, v.ZatvorenoDEV
,v.Racunalo, v.Korisnik, v.DatumAzuriranja
,v.Prijenos_Dok_Dogadjaj, v.Prijenos_dok_zatvara
,v.Red_ID, v.Tem_ID,v.RVrDok--, v.RK_ID
,case --grupiranje po predznaku...
WHEN v.duguje < 0 THEN 'M'
WHEN v.potražuje < 0 THEN 'M'
ELSE 'P'
end
IF @@ERROR <>0
BEGIN
PRINT 'Greska: sp_FINKO_Knjienje_Robnih'
END

declare @Greska as bit
declare @ID_Knjiz as bigint
declare @VrDok1 as varchar(8)
declare @BrDok1 as varchar(8)
declare @Skl as varchar(8)
declare @Anal1 as varchar(8)
declare @Anal2 as varchar(8)
declare @Konto as varchar(8)
declare @Duguje as numeric(18,2)
declare @Potrazuje as numeric(18,2)
declare @SQL_Update as varchar(4000)

SET @Greska = 0 --ovdje pratimo jeli bilo kakvih gresaka a temeljnici


DECLARE rsTmp CURSOR LOCAL FAST_FORWARD READ_ONLY
FOR
SELECT d.ID,d.ak_skladiste,t.r_Vrsta_dokumenta,t.Broj_dokumenta,t.analiticki_konto,t.podanaliticki_konto,t.Konto,t.Duguje,t.Potražuje
FROM #tmpTemeljnica as t INNER JOIN #tmpDokumenti as d
ON t.r_vrsta_dokumenta=d.Dok_Vrsta and t.broj_dokumenta=d.Dok_broj
WHERE
(len(t.oznaka_analitike) = 2 and t.analiticki_konto is null)
OR
(len(t.Podoznaka_analitike) = 2 and t.Podanaliticki_konto is null)
OR
(t.Konto is null)
OR
(t.duguje=0 and t.potražuje=0)
ORDER by d.ID


OPEN rsTmp FETCH NEXT FROM rsTMP into @ID_Knjiz ,@Skl,@VrDok1,@BrDok1,@anal1,@Anal2,@Konto,@Duguje,@Potrazuje
WHILE (@@fetch_status=0)
BEGIN
IF @Anal1 IS NULL
BEGIN
BEGIN TRANSACTION T1
INSERT INTO HeRPuSPrijenos_Greske
(Knjizenje_ID,Modul,Stavka_ID,Stavka_Rbr,Broj_Greske,Opis_Greske1,Opis_Greske2,Opis_Greske3,VrijemeUpisa,Korisnik,Racunalo)
VALUES
(@ID_knjiz,'Robni prijenos',0,0,201,'Ne mogu pronaci analitiku za konto','','',getdate(),'server','server')
COMMIT TRANSACTION T1
SET @Greska=1
END
ELSE IF @Anal2 IS NULL
BEGIN
BEGIN TRANSACTION T1
INSERT INTO HeRPuSPrijenos_Greske
(Knjizenje_ID,Modul,Stavka_ID,Stavka_Rbr,Broj_Greske,Opis_Greske1,Opis_Greske2,Opis_Greske3,VrijemeUpisa,Korisnik,Racunalo)
VALUES
(@ID_knjiz,'Robni prijenos',0,0,202,'Ne mogu pronaci podanalitiku za konto','','',getdate(),'server','server')
COMMIT TRANSACTION T1
SET @Greska=1
END
ELSE IF @Konto IS NULL
BEGIN
BEGIN TRANSACTION T1
INSERT INTO HeRPuSPrijenos_Greske
(Knjizenje_ID,Modul,Stavka_ID,Stavka_Rbr,Broj_Greske,Opis_Greske1,Opis_Greske2,Opis_Greske3,VrijemeUpisa,Korisnik,Racunalo)
VALUES
(@ID_knjiz,'Robni prijenos',0,0,203,'Ne mogu pronaci konto','','',getdate(),'server','server')
COMMIT TRANSACTION T1
SET @Greska=1
END
ELSE IF @Duguje=0 AND @Potrazuje=0
BEGIN
BEGIN TRANSACTION T1
INSERT INTO HeRPuSPrijenos_Greske
(Knjizenje_ID,Modul,Stavka_ID,Stavka_Rbr,Broj_Greske,Opis_Greske1,Opis_Greske2,Opis_Greske3,VrijemeUpisa,Korisnik,Racunalo)
VALUES
(@ID_knjiz,'Robni prijenos',0,0,204,'Stavka za duguje i potrazuje ima 0','','',getdate(),'server','server')
COMMIT TRANSACTION T1
SET @Greska=1
END
FETCH NEXT FROM rsTMP into @ID_Knjiz ,@Skl,@VrDok1,@BrDok1,@anal1,@Anal2
END
CLOSE rsTmp
deallocate rsTmp

if @Greska= 0
BEGIN
declare @PojedinacniPrijenos bit
declare @Tem_vrsta varchar(8) --vrsta tekuce temeljnice
declare @Tem_broj bigint --sljedeci broj iz fin kartica
declare @Tem_Datum smalldatetime --danasnji datum
declare @Tem_ID uniqueidentifier --eto
declare @Knjiz_Mjesec numeric(18,0)
declare @Knjiz_Godina numeric(18,0)
declare @Knjiz_Dnevnik numeric(18,0)

SET @PojedinacniPrijenos=(
select isnull(osiguranje,0) FROM analiticka_konta where oznaka_analitike='50' and analiticki_konto=@VrDok
)
SET @Tem_vrsta =(
select top 1 vrsta_temeljnice from #tmpTemeljnica
)
SET @Tem_broj =(
SELECT isnull(max(dbo.ToNumeric(FK.Broj_temeljnice)),0) +1 --bilo sranje jer je broj_temeljnice varchar pa je sad ToNumeric
FROM Financijske_kartice as FK WHERE FK.Vrsta_temeljnice=@Tem_Vrsta
)
SET @Tem_Datum=CONVERT(CHAR(8),getdate(),112) --treba nam samo datum
SET @Tem_ID=newid()
SET @Knjiz_Mjesec=(
select isnull(podatak,0) from fink where segment='KNJIZIFIN' and naziv= 'Mjesec knjiženja'
)
SET @Knjiz_Godina=(
select isnull(podatak,0) from fink where segment='KNJIZIFIN' and naziv= 'Godina knjiženja'
)
SET @Knjiz_Dnevnik=(
select isnull(podatak,0) from fink where segment='KNJIZIFIN' and naziv= 'Broj dnevnika'
)

UPDATE #tmpTemeljnica SET
Broj_temeljnice =@Tem_broj
,Tem_ID =@Tem_ID
,Datum_temeljnice =@Tem_datum
,Mjesec =@Knjiz_Mjesec
,Godina =@Knjiz_Godina
,Broj_dnevnika =@Knjiz_Dnevnik

--idemo si napravit kopiju temp tablice(treba nam zbog grupnoh odnosno pojedinacnog prijenosa)
SELECT * INTO #tmpTemeljnica1
FROM #tmpTemeljnica WHERE 1=2


--idemo sad grupirat sve sto treba
SET @PojedinacniPrijenos =1 --zasad ostajemo na ovom

IF @PojedinacniPrijenos = 1
BEGIN

INSERT INTO #tmpTemeljnica1
SELECT v.oznaka_analitike
,v.Analiticki_konto
,v.Konto
,v.vrsta_dokumenta
,v.broj_dokumenta
,v.Datum_dokumenta
,sum(v.Duguje) as Duguje
,sum(v.Potražuje) as Potražuje
,v.Opis
,v.Vrsta_Temeljnice, v.Broj_Temeljnice, v.Datum_temeljnice
,v.Tecaj, v.Duguje2, v.Potražuje2
,v.Protukonto, v.Protuanalitika, v.ProtuAnliticki_konto
,v.Zatvoreno, v.Mjesec, v.Godina, v.Broj_dnevnika, v.Saldo
,v.Zatvoren_dnevnik, v.Valuta, v.IdNo
,v.PodOznaka_analitike, v.Podanaliticki_konto
,v.Broj_izvornog_dokumenta, v.Vrsta_dokumentaIzvorni
,v.Broj_dokumentaIzvorni, v.Datum_dokumentaIzvorni
,v.DugujeDEV, v.PotrazujeDEV, v.NovcanaJedinica
,v.ZatvaraDokument
,v.Prijenos_ID, v.Prijenos_DokID
,v.Duguje2DEV, v.Potrazuje2DEV, v.ZatvorenoDEV
,v.Racunalo, v.Korisnik, v.DatumAzuriranja
,v.Prijenos_Dok_Dogadjaj, v.Prijenos_dok_zatvara
,v.Red_ID, v.Tem_ID,''
FROM #tmpTemeljnica as v
GROUP by
v.oznaka_analitike
,v.Analiticki_konto
,v.Konto
,v.vrsta_dokumenta
,v.broj_dokumenta
,v.Datum_dokumenta
,v.Opis
,v.Vrsta_Temeljnice, v.Broj_Temeljnice, v.Datum_temeljnice
,v.Tecaj, v.Duguje2, v.Potražuje2
,v.Protukonto, v.Protuanalitika, v.ProtuAnliticki_konto
,v.Zatvoreno, v.Mjesec, v.Godina, v.Broj_dnevnika, v.Saldo
,v.Zatvoren_dnevnik, v.Valuta, v.IdNo
,v.PodOznaka_analitike, v.Podanaliticki_konto
,v.Broj_izvornog_dokumenta, v.Vrsta_dokumentaIzvorni
,v.Broj_dokumentaIzvorni, v.Datum_dokumentaIzvorni
,v.DugujeDEV, v.PotrazujeDEV, v.NovcanaJedinica
,v.ZatvaraDokument
,v.Prijenos_ID, v.Prijenos_DokID
,v.Duguje2DEV, v.Potrazuje2DEV, v.ZatvorenoDEV
,v.Racunalo, v.Korisnik, v.DatumAzuriranja
,v.Prijenos_Dok_Dogadjaj, v.Prijenos_dok_zatvara
,v.Red_ID, v.Tem_ID,
CASE --grupiranje po predznaku...
WHEN v.duguje < 0 THEN 'M'
WHEN v.potražuje < 0 THEN 'M'
ELSE 'P'
END

END
ELSE
BEGIN
print ''
END


INSERT INTO HeRPuSPrijenos_Temeljnica
SELECT
v.oznaka_analitike,v.Analiticki_konto
,v.Konto
,v.vrsta_dokumenta,v.broj_dokumenta,v.Datum_dokumenta
,v.Duguje,v.Potražuje
,v.Opis
,v.Vrsta_Temeljnice, v.Broj_Temeljnice, v.Datum_temeljnice
,v.Tecaj,v.Duguje2,v.Potražuje2
,v.Protukonto, v.Protuanalitika, v.ProtuAnliticki_konto
,v.Zatvoreno, v.Mjesec, v.Godina, v.Broj_dnevnika, v.Saldo
,v.Zatvoren_dnevnik, v.Valuta,v.rbr
,v.PodOznaka_analitike, v.Podanaliticki_konto
,v.Broj_izvornog_dokumenta, v.Vrsta_dokumentaIzvorni
,v.Broj_dokumentaIzvorni, v.Datum_dokumentaIzvorni
,v.DugujeDEV, v.PotrazujeDEV, v.NovcanaJedinica
,v.ZatvaraDokument
,v.Prijenos_ID, v.Prijenos_DokID
,v.Duguje2DEV, v.Potrazuje2DEV, v.ZatvorenoDEV
,v.Racunalo, v.Korisnik, v.DatumAzuriranja
,v.Prijenos_Dok_Dogadjaj, v.Prijenos_dok_zatvara
,v.Red_ID, v.Tem_ID--,v.RVrDok --, v.RK_ID
FROM #tmpTemeljnica1 as V

IF @@ERROR <> 0
BEGIN
BEGIN TRANSACTION T1
INSERT INTO HeRPuSPrijenos_Greske
(Knjizenje_ID,Modul,Stavka_ID,Stavka_Rbr,Broj_Greske,Opis_Greske1,Opis_Greske2,Opis_Greske3,VrijemeUpisa,Korisnik,Racunalo)
VALUES
(0,'Robni prijenos',0,0,205,'Greska prilikom prebacivanja podataka u HeRPuSPrijenos_Temeljnica','','',getdate(),'server','server')
COMMIT TRANSACTION T1
SET @Greska=1
END

END




-- DROP TABLE #tmpDokumenti --necemo dropat jel ce server dropat nakon zavrsetka procedure
-- DROP TABLE #tmpTemeljnica
-- DROP TABLE #tmpTemeljnica1

IF @Greska=0
BEGIN
set @SQL_Update='update HeRPuSPrijenos_Knjizenja set Temeljnica_Nastala=1, Temeljnica_Greska=0 Where ID IN (' + @vbcrlf
set @SQL_Update=@SQL_Update + @IDs + ') AND Dok_AK=''' + @VrDok + '''' + @vbcrlf
EXEC (@SQL_Update)

UPDATE robne_kartice SET Knjizenje_financijsko=1 WHERE ID IN --updejta robne kartice na knjizeno
(
SELECT v.RK_ID
FROM vfk_rk as v INNER JOIN #tmpDokumenti as D
ON v.broj_dokumenta=d.dok_Broj AND V.AK_skladiste=D.AK_skladiste AND V.vrsta_dokumenta=@VrDok
)

END
ELSE
BEGIN
set @SQL_Update='update HeRPuSPrijenos_Knjizenja set Temeljnica_Nastala=0, Temeljnica_Greska=1 Where ID IN (' + @vbcrlf
set @SQL_Update=@SQL_Update + @IDs + ') AND Dok_AK=''' + @VrDok + '''' + @vbcrlf

EXEC (@SQL_Update)
END
END





GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

--SNIP--



update HeRPuSPrijenos_Knjizenja set Temeljnica_Nastala=1, Temeljnica_Greska=0 Where
ID IN (select ID from #tmpDokumenti)

View 1 Replies View Related

Help W/ Parameters PART 2

Jul 19, 2007

I created a Tabular report... The data string is




Code Snippet

SELECT dbo.forehist_txt.Item, dbo.forehist_txt.Class1, dbo.forehist_txt.Description, dbo.forehist_txt.Price, dbo.DSItem2_txt.UserDefined1,
dbo.DSItem2_txt.UserDefined3, dbo.forehist_txt.AdjustedHistory15, dbo.forehist_txt.AdjustedHistory14, dbo.forehist_txt.AdjustedHistory13,
dbo.forehist_txt.AdjustedHistory12, dbo.forehist_txt.AdjustedHistory11, dbo.forehist_txt.AdjustedHistory10, dbo.forehist_txt.AdjustedHistory9,
dbo.forehist_txt.AdjustedHistory8, dbo.forehist_txt.AdjustedHistory7, dbo.forehist_txt.AdjustedHistory6, dbo.forehist_txt.AdjustedHistory5,
dbo.forehist_txt.AdjustedHistory4, dbo.forehist_txt.AdjustedHistory3, dbo.forehist_txt.AdjustedHistory2, dbo.forehist_txt.AdjustedHistory1,
dbo.forehist_txt.SystemForecast1, dbo.forehist_txt.SystemForecast2, dbo.forehist_txt.SystemForecast3, dbo.forehist_txt.SystemForecast4,
dbo.forehist_txt.SystemForecast5, dbo.forehist_txt.SystemForecast6, dbo.forehist_txt.SystemForecast7
FROM dbo.forehist_txt INNER JOIN
dbo.DSItem2_txt ON dbo.forehist_txt.Item = dbo.DSItem2_txt.Item AND dbo.forehist_txt.Company = dbo.DSItem2_txt.Company AND
dbo.forehist_txt.Division = dbo.DSItem2_txt.Division AND dbo.forehist_txt.Corporation = dbo.DSItem2_txt.Corporation AND
dbo.forehist_txt.Sold = dbo.DSItem2_txt.Sold AND dbo.forehist_txt.Department = dbo.DSItem2_txt.Department AND
dbo.forehist_txt.ShipTo = dbo.DSItem2_txt.ShipTo



I have created two Parameters... ProductManagers (i.e. John) and Comments (i.e. Top 500).



ProductManagers is Data type: String. Multi-value is checked. I created a new dataset (ProductManagers) so that way the values are only one instance instead of several instances. Available values: From query. Default values: Null.



Comments is Data type: Sting. Multi-value is checked. I created a new dataset so that way the values are only one instance instead of several instances. Available values: From query. Default values: Null.



PROBLEM:



When I click Preview to preview the report and select the desired parameters, my report is not filtered by the parameters. It simply returns every single record.



So two Questions:



1) How do I get the report to return results based off of the parameters?



2) How do I setup the parameters so that I can filter results by John only, Top 500 only, and John OR Top 500?

View 11 Replies View Related

Part Date In Sql

Mar 6, 2008

Hi,

I think this is a simple question but I am just not sure how to do it right, as a newbie.

All I want to do is generate a report of company employees grouped by their date of hire.

SELECT DateOfHire, FirstName, LastName from Empls
ORDER BY DateOfHire

The only problem is that the DateOfHire displays as, e.g., '01/03/2004 12:00:00' which is not what I want. I SIMPLY WANT TO OMIT THE TIME PART but don't know quite how to say this. I tried several variations along this line but it causes scoping errors...

SELECT CONVERT(Varchar(10), DateOfHire, 101) AS DOHDateOnly, FirstName, LastName, State
FROM EMPL
GROUP BY DOHDateOnly

but this gives error

"The value expressions for the textbox ‘DateOfHire’ refers to the field ‘DOHDateOnly’. Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope."

Which makes sense, but I don't know HOW to say the right thing to get what I want.

Any help will be greatly appreciated.

View 1 Replies View Related







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