Saturday, March 9, 2013

[SQL Server] import data with identity columns...

[SQL Server] import data with identity columns...


import data with identity columns...

Posted: 09 Mar 2013 06:02 AM PST

Really going crazy here!I have table1 and table2 [for e.g. purpse]. They are of exact design:id [autoincrement, primary key, int]name [varchar(10))creatorid [int] --code of the office which inserted the row?both can contain the same id value. I need to bring table1 data to table2 while keeping the data. The db was designed for use in a NT but now there are offices which are not networked and their data needs to come to the central office thru export. How do we do that?Every row got id of the office which created it. The problem is that the id column is referenced in other tables. Any insight please?

show single field across several fields in record set?

Posted: 09 Mar 2013 02:01 AM PST

I have a table where I query one of the fields. my question is, is there a way I can produce the results across 3 fields? I'd like to use a datagrid on a webpage with 3 columns, and fill the datagrid with the record set starting at the first column with the first result, then the second column with the second result, then the third column with the third result, then the first column second row gets the fourth result and so on. I'm assuming I need to populate a tempory table which has 3 columns with the data from my table? but I'm not sure how.my table would be populated like;field1item1item2item3item4item5item6item7...... and so onthe desired record set as shown in my datagrid would look likeField1 Field2 Field3item1 item2 item3item4 item5 item6item7 ....... ........

What's wrong with this SQL?

Posted: 09 Mar 2013 02:54 AM PST

VBA - I'm trying to insert a record into MS Access from Excel.... It keeps telling me that something is wrong with the INSERT INTO statement... I tried changing the 'dateReg' (date registration) variable to delimiters #, also tried with strings ", same message. dateReg is a date field in the dB, the rest fields are text. I have no problem retrieving data (Select).Any advice will be greatly appreciated... thxSub InsertRecordDB()Dim con As ConnectionDim rs As Recordset Set con = New Connection con.connectionstring = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Persist Security Info=False;Data Source=" & _ "C:\ExcelApplications\Databases\Development.mdb" con.Open ' Instantiate the Recordset object, then set its properties. Set rs = New Recordset With rs .Source = "INSERT INTO tblUsers values('" & txtUN.Text & "', '" & txtPW.Text & "', '" & cboUsers.Text & "', '" & txtPicNum.Text & "', '" & dateReg & "', '" & cboFloors.Text & "', '" & cboGender.Text & "', '" & cboAdmin.Text & "')"also tried this, adding # delimiter to dateReg: .Source = "INSERT INTO tblUsers (Username, Password, Name_Lname, Image_Number, RegisteredDate, Floor_Num, Gender, Emp_Type) values('" & txtUN.Text & "', '" & txtPW.Text & "', '" & cboUsers.Text & "', '" & txtPicNum.Text & "', #" & dateReg & "#, '" & cboFloors.Text & "', '" & cboGender.Text & "', '" & cboAdmin.Text & "')" Set .ActiveConnection = con .CursorLocation = adUseClient .CursorType = adOpenStatic ' Open the recordset. .Open End With Dim RowCnt, FieldCnt As Integer RowCnt = 1 ' Use field names as headers in the first row.' For FieldCnt = 0 To rs.Fields.count - 1' Cells(RowCnt, FieldCnt + 1).Value = _' rs.Fields(FieldCnt).name' Rows(1).Font.Bold = True' Next FieldCnt ' Fill rows with records, starting at row 2. RowCnt = 2 ' While Not rs.EOF' For FieldCnt = 0 To rs.Fields.count - 1' Cells(RowCnt, FieldCnt + 1).Value = _' rs.Fields(FieldCnt).Value' Next FieldCnt' rs.MoveNext' RowCnt = RowCnt + 1' Wend con.Close Call Sheet1.UndoSplashScreen MsgBox "Record inserted successfully!"End Sub

Best way to store images

Posted: 08 Mar 2013 06:59 PM PST

Hi.I recognized if we store an image in binary type in SQL SERVER they take more space. For example a 700kb image take about 900kb space.With this condition which way is better to store images?

No comments:

Post a Comment

Search This Blog