SQL database(Spliting a column)

i want to make an attendance database by using visual basic.net, i have one main table that keep the days, each day have a separate column, but what i need is to insert each day multiple periods, so how can i do it please..

thanks all members.

February 10th, 2015 2:59am

Hello,

You question is not clear for me. Please post DDL of your table, some sample data as INSERT statement and the expected result.

Free Windows Admin Tool Kit Click here and download it now
February 10th, 2015 3:30am

Just a guess 

MERGE statement along with output.inserted table.

February 10th, 2015 3:31am

I wont recommend a design like this. Ideally you should store data as rows one for each date in the database table. You dont need to worry on display format while designing table/ storing the data.

Its very easy to generate attendance data column wise  from rowwise stored data in the table. You can use readymade reporting tools like SQL reporting Services which has standard features like Matrix containers for doing dynamic pivotting like this. If you want to use languages like VB also you can create pivot logic inside.

In SQL if you want to do this you can use PIVOT operator or classic crosstabbing solutions as shown in below links

http://beyondrelational.com/modules/2/blogs/70/posts/10840/dynamic-pivot-in-sql-server-2005.aspx

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx

Free Windows Admin Tool Kit Click here and download it now
February 10th, 2015 4:18am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics