开发者

Populating aspnet_Profile table via TSQL

开发者 https://www.devze.com 2023-03-23 13:51 出处:网络
I\'m trying to bulk load the aspnet members via TSQL from CSV File or Database sources. I\'m happy with any other options i.e. net application or ssis packages.

I'm trying to bulk load the aspnet members via TSQL from CSV File or Database sources. I'm happy with any other options i.e. net application or ssis packages.

The problem I'm facing is that each members have a their own profile as blow:

  1. First Name
  2. Last Name
  3. Mobile
  4. Company Add .... etc.

Looks like aspnet profile is stored as

PropertyNames and PropertyValu开发者_JAVA百科es

in backend aspnet_profile table.

Could anyone please suggest me how I can load the employee data and their profile on to aspnet membership database?

Thanks.


Well, assuming your problem is how to represent profile values correctly, here's how it's actually being stored in DB:

aspnet_Profile.PropertyNames contains profile variable names, corresponding storage descriptor and value length as follows: [VariableName]:[Storage]:[Start]:[Length]:[VariableName] ... where

  • [VariableName] - your profile variable name
  • [Storage] - one char. B for Binary, S for String
  • [Start] - value start position in storage string or byte array
  • [Length] - value length

Example: Test1:S:0:10:Test2:B:0:100:Test3:S:10:5:TestDate:S:15:95

aspnet_Profile.ProfileValuesString contains profile values concatened one by one with no delimiters or anything else. To generate this column value you don't actually have to measure lenghts of values. To read from there you obviously have to. Note: DateTime values are being wrapped into XML when serialized to PropertyValuesString.

Example: TestStringABCDE<?xml version="1.0" encoding="utf-16"?> <dateTime>2011-07-29T10:00:28.1603073+04:00</dateTime>

aspnet_Profile.ProfileValuesBinary is pretty much the same as previous one. Except it's binary

So, having that said, your scenaro would be to get your csv data into a temp table in DB, then run a script over it to generate PropertyNames (most complex part here) and PropertyValuesString (easiest part). That's it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号