Skip to content

Database

Discussions on database access, SQL, and ADO

This category can be followed from the open social web via the handle database@forum.codeproject.com

17.1k Topics 61.8k Posts
  • Visual studio 2010 ssis

    sql-server csharp database visual-studio sysadmin
    4
    0 Votes
    4 Posts
    0 Views
    C
    SSIS has a problem importing data from Excel if the first few rows (5 I think) are in numeric format, but subsequent rows contain data that cannot be parsed as numerical. There is a way of changing the connection from SSIS to get it t not guess the column type - you need to set IMEX=1 in the connection string Check this article - [Importing data from Excel having Mixed Data Types in a column (SSIS) | Tech Updates](https://munishbansal.wordpress.com/2009/12/15/importing-data-from-excel-having-mixed-data-types-in-a-column-ssis/) ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================
  • SQL boolean comparison

    database help question
    13
    0 Votes
    13 Posts
    0 Views
    U
    NULLs cannot be compared in SQL
  • help SQL query

    database help
    3
    0 Votes
    3 Posts
    0 Views
    U
    With Numbering As (Select *,(case when len(phone) > 0 then 1 else 0 end) as Number From dbo.table2) select classid,count(student_name),sum(number) from Numbering group by classid;
  • 0 Votes
    2 Posts
    1 Views
    realJSOPR
    I found a work around. Instead of directly using the Imported_XXX table directly, or using a temporary table, I creates a view that performed the grouping, and that seems to have fixed my problem. It has been suggested that there might be a bug in the Merge functionality. ".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • GET ALL YOUR TRAVELLING DOCUMENTS

    database com
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Convert or use expression in Sql select statement

    database question
    3
    0 Votes
    3 Posts
    0 Views
    Z
    SELECT CASE WHEN MCTR_DESCR IN ('Large', 'Midsize') THEN 'LG' ELSE '' END ... etc. Just build it out. It's all pretty straightforward. There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.
  • Open Access 365 Database

    help csharp database com question
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • SSIS Package creating XML

    sql-server database sysadmin xml help
    2
    0 Votes
    2 Posts
    0 Views
    J
    Member 13357915 wrote: It's lists all odd numbered records first then all the even numbered ones. Why is that a problem? Member 13357915 wrote: so I cannot see why this is happening. Assuming ordering perhaps. If you are not explicitly ordering the records then you are assuming the ordering. There is no assurance of ordering. It might normally be ordering (default ordering) by the primary index and that might change with a cluster.
  • IF then ?

    database question career
    10
    0 Votes
    10 Posts
    0 Views
    P
    Hello, Use REPLICATE() and RIGHT Functions, SELECT RIGHT(REPLICATE(0,2)+CAST([EMPLOYEE].JOB_CODE AS NVARCHAR(200)),3) FROM YourTable Regards, Pradeep M
  • sql Query help

    database help
    5
    0 Votes
    5 Posts
    0 Views
    Richard DeemingR
    Try changing the ROW_NUMBER ordering: ROW_NUMBER() OVER ( PARTITION BY [Device id] ORDER BY CASE WHEN [Effective Date] <= @YourDateParameter THEN 0 ELSE 1 END, CASE WHEN [Effective Date] <= @YourDateParameter THEN [Effective Date] ELSE Null END DESC, CASE WHEN [Effective Date] <= @YourDateParameter THEN Null ELSE [Effective Date] END ) As RN Dates on or before the date parameter come first; Dates on or before the parameter are sorted in descending order, so the latest comes first; Dates after the parameter are sorted in ascending order, so the earliest comes first; "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • 0 Votes
    3 Posts
    0 Views
    C
    You probably are not getting any results because you have not defined the parameter to pass to the to_date function. to_date (string_to_convert_to_date, [optional parameters if required]). If you are trying to pull from "today" then use to_date(sysdate)
  • SQL Linq, getting 3 of each record.

    csharp asp-net database linq architecture
    4
    0 Votes
    4 Posts
    0 Views
    A
    Instead of removing them, you can just group them by their ID. :laugh: The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
  • Setting values from a Pivot to 0?

    question career
    4
    0 Votes
    4 Posts
    1 Views
    P
    I tried it but it comes back with Syntax error, my environment is MS SQL SERVER Management Studio 2016: FOR Pay_ClassHrs in (ISNULL(PBS_Hrs, 0), POT_Hrs, PED_Hrs, POR_Hrs, PJB_Hrs, PTO_Hrs, PWH_Hrs, PHR_Hrs, PNH_Hrs) Any ideas...!
  • Pruning unused tables in a live database.

    database question tools xml tutorial
    10
    0 Votes
    10 Posts
    0 Views
    J
    :thumbsup: Indeed! Oh, and the OCD as well. :-\ Wrong is evil and must be defeated. - Jeff Ello
  • 0 Votes
    2 Posts
    0 Views
    Richard DeemingR
    LOKENDRA YADAV wrote: select username,password,role from studentstable Not an answer to your question, but there's a more fundamental problem with your code: You're storing passwords in plain text. NEVER do that. And don't use reversible encryption either. Store a salted hash of the password, using a unique salt per record. Secure Password Authentication Explained Simply[^] Salted Password Hashing - Doing it Right[^] "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • Need to load bulk Data with some conditions

    4
    0 Votes
    4 Posts
    0 Views
    I
    Hey buddy, I tried this and mostly +ve that it should be working, but if you find any flaws in it please point me out, related to anything in this Code. ALTER procedure [EOC].[UpdateFalloutSolicitationResponseErrorDetail] (@FullFileName nvarchar(max)='') AS BEGIN TRUNCATE TABLE Saw_raw.[EOC].[FalloutSolicitationResponseErrorDetail_InsertedRecords] TRUNCATE TABLE Saw_raw.[EOC].[WorkInserted] DECLARE @TeamId bigint =0, @MaxInstanceIdFromSaw\_2 bigint=0, @ActivityId bigint=0 , @BatchId bigint=0, @StatusId int=0, @CreatedbyAccountId int=0, @DepartmentId int=1, @PieceCount int=1, @RecordCount int =0; SELECT top 1 @TeamId=Id FROM SAW\_2.\[dbo\].\[Team\] WHERE TeamName='MEP - Small Group' AND DepartmentId=@DepartmentId SELECT top 1 @ActivityId=Id FROM SAW\_2.\[dbo\].Activity WHERE ActivityName='EoC – Facets Inbound Error Report' AND TeamId=@TeamId SELECT top 1 @BatchId=Id FROM SAW\_2.\[dbo\].Batch WHERE BatchName ='EoC Fallout Error Reports' SELECT top 1 @CreatedbyAccountId=Id FROM SAW\_2.\[dbo\].Account WHERE LanId ='SYSTEM' select @StatusId=Id from SAW\_2.\[dbo\].\[Status\] WHERE StatusName='New' IF EXISTS ( SELECT \* FROM sys.key\_constraints WHERE type = 'PK' AND OBJECT\_NAME(parent\_object\_id) = 'FalloutSolicitationResponseErrorDetail' ) BEGIN ALTER TABLE \[EOC\].\[FalloutSolicitationResponseErrorDetail\] DROP CONSTRAINT PK\_FalloutSolicitationResponseErrorDetail\_InstanceId END IF EXISTS (SELECT name FROM sys.indexes WHERE name = N'IX\_FalloutSolicitationResponseErrorDetail\_CoveredID') BEGIN DROP INDEX IX\_FalloutSolicitationResponseErrorDetail\_CoveredID ON \[EOC\].\[FalloutSolicitationResponseErrorDetail\]; END IF EXISTS (SELECT name FROM sys.indexes WHERE name = N'IX\_FalloutSolicitationResponseErrorDetail\_CoveredindividualsInsuranceIDorCardnumber') BEGIN DROP INDEX IX\_FalloutSolicitationResponseErrorDetail\_CoveredindividualsInsuranceIDorCardnumber ON \[EOC\].\[FalloutSolicitationResponseErrorDetail\]; END IF EXISTS (SELECT name FROM sys.indexes WHERE name = N'IX\_FalloutSolicitationResponseErrorDetail\_SSNorITIN') BEGIN DROP INDEX IX\_FalloutSolicitationResponseErrorDetail\_SSNorITIN ON \[EOC\].\[FalloutSolicitationResponseErrorDetail\]; END IF EXISTS (SELECT name FROM sys.indexes WHERE name = N'IX\_FalloutSolicitationResponseErrorDetail\_LastName') BEGIN DROP INDEX IX\_FalloutSolicitationResponseErrorDetail\_LastName ON \[EOC\].\[FalloutSolicitationResponseErrorDetail\]; END IF EXISTS (SELECT name FROM sys.indexes WHERE name = N'I
  • 0 Votes
    8 Posts
    0 Views
    I
    Thanks my friend :) Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."
  • ms access 2016 database

    database
    18
    0 Votes
    18 Posts
    0 Views
    Richard DeemingR
    AFAIK, the default download for Firefox is 32-bit, even if you're on a 64-bit OS. You have to click on the "Firefox for Other Platforms & Languages" button to get the 64-bit version. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • 0 Votes
    3 Posts
    0 Views
    J
    Just noting.... "lob", from the file name suggests binary data. In general, programming languages differentiate between binary and text data. Your code used a "String" type. That works under one or both of the following conditions. 1. The files wear in fact text 2. Excel did not attempt to translate them. You can validate the above by exporting at least one file and verifying that it matches the input both in length and content.