Tag: sql

  • Error Number:8152,State:10,Class:16 String or binary data would be truncated. The statement has been terminated. – Entity Framework

    Hi everyone, I ran into the following error after adding model validation attributes to a database with existing values: Error Number:8152,State:10,Class:16 String or binary data would be truncated. The statement has been terminated. The solution is pretty straightforward if you’re happy to truncate the values. Simply run the query below, swapping Title for your column…

  • The installer has encountered an unexpected error installing this package.This may indicate a problem with this package.The error code is 29506 – SQL Server Management Studio

    Hey everyone, I ran into the following error while trying to install Sql Server Management Studio on Windows 8: The installer has encountered an unexpected error installing this package.This may indicate a problem with this package.The error code is 29506 To fix it, all you need to do is run the exe with administrative privileges.

  • View Generated SQL in Entity Framework (EF)

    Hey everyone, Just a quick post on how to view the generated sql in entity framework. To start with, just add the following line to your db context constructor: public class TestDbContext : DbContext { public TestDbContext() : base(“name=TestDbContext”) { this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); //This line } … With this line added, you should…

  • ORA-28000: the account is locked – PeopleSoft

    Hey everyone, Just a small PeopleSoft issue I ran into while running an SQR: (SQR 5528) ORACLE OCISessionBegin(RDBMS) error 28000 in cursor 0: ORA-28000: the account is locked (SQR 4701) Cannot logon to the database. SQR for PeopleSoft: Program Aborting. For some reason the sysadm account had been locked, thankfully there’s a fairly easy fix:…

  • View Last Query Executed – Oracle

    Hey all, Just a quick post on how to view recent queries run into an Oracle database: SELECT sql_text, sql_fulltext FROM v$sql ORDER BY last_load_time DESC Cheers

  • Oracle – Number of Weekdays Between Two Dates

    Hey everyone, Just a quick post on how to select the number of weekdays between two dates: SELECT temp_tbl.days –SELECT COUNT(temp_tbl.days) FROM ( SELECT (TRUNC(TO_DATE (’01/08/2012′, ‘DD/MM/YYYY’), ‘dd’) + LEVEL – 1) days FROM DUAL CONNECT BY LEVEL = 2 AND TO_CHAR(temp_tbl.days, ‘D’) <= 6

  • Sending Email – PL/SQL

    A quick post on how to send an email with PL/SQL. There’s a LOT of documentation available at the following link: http://www.orafaq.com/wiki/Send_mail_from_PL/SQL PROCEDURE EMAIL_ERROR_REPORT IS /* Create vars */ v_From VARCHAR2 (80) := ‘test@test.com’; v_Recipient VARCHAR2 (80) := ‘me@me.com’;–REPORT_RECEIVER; v_Subject VARCHAR2 (80) := ‘test subject’; v_Mail_Host VARCHAR2 (30) := ‘smtp.test.com’; v_Mail_Conn UTL_SMTP.Connection; crlf VARCHAR2 (2)…

  • Unique Values – Ruby on Rails

    Just a quick post on how to select unique values in rails using the uniq operator: #All recent categories #Results Cars Trucks Cars Technology Phones Technology … #Unique recent categories Cars Trucks Technology Phones …

  • ERROR: column “category” does not exist

    I’ve recently switched from SQLite3 to PostGreSQL and came across the following error this morning: my_app_development=> select category from codes; ERROR: column “category” does not exist LINE 1: select category from codes; The following post solved the issues in one sentence: http://archives.postgresql.org/pgsql-novice/2007-01/msg00032.php Yes. In postgres, unquoted column and table names are converted to lower case.…

  • undefined method `to_sym’ for nil:NilClass – Ruby on Rails Migration

    While trying to do a migration today I received the following message: undefined method `to_sym’ for nil:NilClass #After running a trace (rake db:migrate –trace) undefined method `to_sym’ for nil:NilClass /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing’ … This was the migration: class AddDefaultValuesToFeedbacks 0 change_column :stores, :rating, :decimal, :precision => 8, :scale => 2, :default => 0 end end Unfortunately…

Create a website or blog at WordPress.com