sql-server

Manipulate sql Server database in vb.net

Do you know of any beginner tutorial on how to manipulate(Add, Edit, Delete, Search, List) sql Server database in vb.net? ...

How can I get DateTime object from SQL Server 2008 in ASP.NET?

System.DateTime start_time = (System.DateTime)phones_.GetStartTime(callInfo.No[1].e164, callInfo.No[0].e164)[0][0]; ...

ExecuteNonQuery on a stored proc causes it to be deleted

This is a strange one. I have a Dev SQL Server which has the stored proc on it, and the same stored proc when used with the same code on the UAT DB causes it to delete itself! Has anyone heard of this behaviour? SQL Code: -- Check if user is registered with the system IF OBJECT_ID('dbo.sp_is_valid_user') IS NOT NULL BEGIN DROP...

trying to add data in SQL Server 2005 database in vb.net

Could someone please help me in here, I'm just a beginner who want to learn on manipulating SQL Server data using vb.net. I have already experienced manipulating data in ms access. So I just recycled the code that I used in here. But unfortunately I got this error: Object reference not set to an instance of an object. And another prob...

Cannot update Excel source properties in SSIS package

I have an SSIS package that imports an excel spreadsheet into an SQL Server 2008 database. I have an Excel connection in the Connection Managers tab and it points to an Excel file on my local computer. But when I open the Excel Source in Data Flow, if I try to view columns or change the "Name of Excel sheet:" I get this error. Error a...

Problem after assigining port number to MSSQL2005 named instance:Service won't start

Hello Guys! I'll like to combine both my initial problem which leads me to this one and this one. my first problem was to be able to connect jaspersoft ireport 3.7.0 to MSSQL2005.I downloaded the jar from microsoft downloads and added the `jdbc4.jar` from the `irepot>tool>classpath>add jar`. It went fine but i needed the port numb...

Regional problems with C# and SQL Database

Why would dateTimePicker.Value.Date.ToShortDateString(); act differently on Windows 7 x64 PL, Windows Vista x32 PL and Windows XP PL with to my knowledge exact regional settings. I've found it out the hard way that i was doing this conversion prior to entering it to DB. It was working fine on Windows 7 (my development machine), colleag...

Multiple storage of images and BLOB files in SQL Server

I have a question about this query on inserting. INSERT INTO BLOBTest (BLOBName, BLOBData) SELECT 'First test file', BulkColumn FROM OPENROWSET( Bulk 'C:\temp\nextup.jpg', SINGLE_BLOB) AS BLOB It works great, but my question is how do I insert more than one image at a time? I have a directory that has 1000+ images I need to i...

how to take sql database backup without data

Possible Duplicate: Backup SQL Schema Only? Hi Anybody tell how to take sql database backup without data. i wanted to take all the tables and structures from sql server 2008. and import to another sql server 2008. i dont need the data. Appreciate your help Regards Joseph ...

Using the ASP.NET membership provider database with your own database?

Hello everybody, We are developing an ASP.NET MVC Application that currently uses it's own database ApplicationData for the domain models and another one Membership for the user management / membership provider. We do access restrictions using data-annotations in our controllers. [Authorize(Roles = "administrators, managers")] This ...

SQL Server 2008 - Identity Column Skipped a Row ID

I have never seen this before, the rows will be sequential but I have noticed that it skipped over a particular "ID".... 1 2 3 4 6 7 8... missing 5... There are no transactions in the INSERT stored procedure so nothing to roll back We do not allow the deletion of records. What else can be the case? ...

SQL Server 2008 - Execute Batch Job and Bulk Insert in T-SQL

Hi I am faced with an interesting problem and I am not even sure if it is possible: I need to create a Stored Procedure in SQL Server 2008 that when executed does the following: Executes a Batch file - located on the SQL Server (i.e. C:\Mybatchfile.bat) - This Batch file will output a single text file to a directory on the SQL Server...

SQL server query to get the list of columns in a table along with Data types, NOT NULL, and PRIMARY KEY constraints

Hey guys. I need to write a query on SQL server to get the list of columns in a particular table, its associated data types and their length and if they are not null. I have managed to do this much. But now i also need to get in the same table against a column - TRUE if it is a primary key. How do i do this ? This is how the output s...

Is there a way to rename a similarly named column from two tables when performing a join?

I have two tables that I am joining with the following query... select * from Partners p inner join OrganizationMembers om on p.ParID = om.OrganizationId where om.EmailAddress = '[email protected]' and om.deleted = 0 Which works great but some of the columns from Partners I want to be replaced with similarly named columns f...

PowerShell script to list items in collection

Hi, I'm new to PowerShell and am trying to query against my SQL server. I get the idea of creating a new-psdrive and then navigating to databases etc and have a line of code as $dbs = (get-childitem sqlserver:\sql\SERVER\INSTANCE\databases) when I pipe the $dbs to a foreach, how would I get results of a collection of the databa...

How to call an extended procedure from a function

hi im having trouble trying to get the following function to work. CREATE FUNCTION test ( @nt_group VARCHAR(128) ) RETURNS @nt_usr TABLE ( [name] [nchar](128) NULL , [type] [char](8) NULL , [privilege] [char](9) NULL , [mapped login name] [nchar](128) NULL , [permission path] [nchar](128) NULL ) AS BEGIN ...

How to populate a column with a count of numbers?

I am converting to an integer primary key and am having trouble seeding the new column data with a count of integer numbers. Given an existing table: create table t1 ( Id uniqueidentifier, NewId int, Data nvarchar(100) ) How would I update existing rows with a count of numbers from 1 to the # of rows in the result set? So: |...

Entity Data Model (edmx) services returning sql server 2008 image type as binary access by iPhone SDK through NSURLConnection

I have a sql image type field coming back in an EDM (Entity Data Model) .NET service call. The image field is stored as binary in sql server 2008. However, I'm not sure what is happening to the image data, or what type of encoding. And since the webservices are generated behind the scenes, I can’t figure out if the service is doing somet...

where clause from where clause

i need to do this : There is a table called table1 it has a employee id column,status column which has values 1 and 0 only and a department column with values 100,101,102. i want to list all employeeid with the status = 0 and (department=100 whose status=1) Please help me ...

What datatype should be used for the Id primary key columns using a hilo generator and sql server?

If I am using a hilo generator with nhibernate, what should the datatype for my id column be? int or bigint? ...